Create Phone Number Links in HTML

Subodh Poudel Feb 19, 2023 Feb 09, 2022
Create Phone Number Links in HTML

This article will guide you through calling a phone number from a mobile device using HTML. First, we will create a link in HTML, which calls the number when the link is called.

We can create phone number links in HTML using the anchor a tag used to create hyperlinks. We can specify the phone number in a readable format between the a tag and set it in the href attribute.

We use the tel: keyword followed by the phone number in the href attribute. This syntax creates a link to direct a call to the phone number.

For example, create an a tag and write tel:907-212-7084 in the href attribute. Next, write the same number between the a tag.

When we visit the webpage from mobile devices, a clickable link with the phone number will appear. When the hyperlink is clicked, it will redirect the user to the phone number dial pad with the phone number.

Example Code:

<a href="tel:907-212-7084">907-212-7084</a>

It is better to use the country code before the phone number because the web page’s user may be from a different country.

The example below represents the phone number of the USA.

Example Code:

<a href="tel:+1-907-212-7084">+1-907-212-7084</a>

The - sign between the numbers in the examples above is written for readability. It is not mandatory to write in such a format.

Using the country code is necessary when dialing the phone number from other countries. If you have a local business limited only within your country, you do not need to use the country code on your website.

Subodh Poudel avatar Subodh Poudel avatar

Subodh is a proactive software engineer, specialized in fintech industry and a writer who loves to express his software development learnings and set of skills through blogs and articles.