How do I hyperlink a phone number?

Learn how do i hyperlink a phone number? with practical examples, diagrams, and best practices. Covers html, href development techniques with visual explanations.

Hyperlinking Phone Numbers: The 'tel:' Protocol Explained

Hero image for How do I hyperlink a phone number?

Learn how to create clickable phone numbers on your website using the 'tel:' URI scheme, enhancing user experience on mobile devices.

In today's mobile-first world, making it easy for users to contact you is paramount. One common requirement is to allow users to directly call a phone number by tapping or clicking on it. This article will guide you through the process of hyperlinking phone numbers using the tel: URI scheme, ensuring your website is user-friendly across all devices.

The tel: URI scheme is a standard way to create hyperlinks that, when activated, initiate a phone call to the specified number. This is incredibly useful for mobile users, as it eliminates the need to manually dial a number. On desktop computers, clicking a tel: link might open a softphone application (like Skype or Microsoft Teams) or prompt the user to choose an application.

<a href="tel:+1-555-123-4567">Call Us</a>
<a href="tel:555-123-4567">555-123-4567</a>

Basic tel: hyperlink examples

While browsers are generally forgiving, it's best practice to format phone numbers within tel: links using a standardized approach. The E.164 format is recommended, which includes a + sign followed by the country code, then the full number without spaces or hyphens. However, for display purposes, you can format the visible text of the link in a more user-friendly way.

<!-- Recommended for maximum compatibility -->
<a href="tel:+18005550123">Call 1-800-555-0123</a>

<!-- Acceptable, but E.164 is preferred for href -->
<a href="tel:800-555-0123">800-555-0123</a>

Phone number formatting in tel: links

flowchart TD
    A[User Clicks Link] --> B{Device Type?}
    B -->|Mobile| C[Initiate Phone Call]
    B -->|Desktop| D[Open Softphone App / Prompt User]
    C --> E[Call Connected]
    D --> E[Call Connected]

Flow of a tel: hyperlink activation

Adding Extensions and Pauses

You might need to include an extension number or a pause in the dialing sequence. The tel: URI scheme supports this using p for pause and w for wait. A p typically represents a short pause (around 0.5 to 1 second), while w waits for a dial tone. Multiple p characters can be used for longer pauses.

<!-- Dial 555-123-4567, then pause, then dial extension 123 -->
<a href="tel:+1-555-123-4567p123">Call Sales (Ext. 123)</a>

<!-- Dial 555-123-4567, wait for dial tone, then dial extension 456 -->
<a href="tel:+1-555-123-4567w456">Call Support (Ext. 456)</a>

Using pauses and waits for extensions

Best Practices for Accessibility and User Experience

Beyond just making the link work, consider the overall user experience. Clearly label your phone numbers, use appropriate styling, and ensure they are accessible to all users.

Instead of just Click here, use text like Call Us Now, Contact Support, or display the full phone number.

2. Ensure Visibility

Make sure the link is clearly visible and distinguishable from regular text. Use appropriate CSS for styling.

3. Provide Alternatives

For users who might not want to make a call, always offer alternative contact methods like email forms or live chat.

4. Test on Multiple Devices

Verify that your tel: links work correctly on various mobile phones (iOS, Android) and desktop browsers with different softphone configurations.