Encodera

Thanks for reading!

Donate to the site — we work hard for you.

How to make a phone or email link

Short answer

For a phone the href uses the tel: scheme, for email — mailto::

<p>Call us: <a href="tel:+15551234567">+1 555 123-45-67</a></p>
<p>Write to us: <a href="mailto:hello@example.com">hello@example.com</a></p>

On a phone, tapping the first link opens the dialer, the second one — the mail app.

The number in href

In the address the number is written in international format, without spaces, brackets or hyphens: tel:+15551234567. The link text can be anything — in an easy-to-read form.

An email with a subject and text

Parameters can follow the address: the subject, the body text and a copy cc. Spaces in them are replaced with %20:

<a href="mailto:hello@example.com?subject=Order%20question&body=Hello!">Ask about an order</a>

Messengers

Links to messaging apps work similarly, for example sms:+15551234567 opens messages with this number.

Common mistake

The number in href is written with spaces and brackets or without the country code: tel:8 (555) 123-45-67. Some phones parse such a number, others dial it wrong or not at all. The address should contain only +, the country code and digits.

Functions used in this recipe

  • <a> — A link to another page, a file or a place on the page.
  • href — The address an `<a>` link leads to or a `<link>` points at.

Thanks for reading!

Donate to the site — we work hard for you.