How To Create Links On Your Website That Send A Text Message (Click-To-Text Links)

March 21, 2023

Creating an HTML link that sends an SMS is super simple and can be a cool way to make your website or web page a bit more interactive.

In this quick tutorial I'm going to show you how to do it!

What is An SMS Link?

An SMS link is a link that, when clicked, opens up the default SMS app on a user's phone OR computer and pre-populates the message with whatever text you specify.

This way, a user can quickly send a text to a pre-defined number without having to manually type it out.

SMS Link Example

Check this out. When you click the link below it should bring up your phone or your computers default app for text messaging and prepopulate both the phone number and message:

Did you click the link? You may have noticed it opened an app and created a message "Hey Roezan dudes, thanks for creating an awesome tutorial"

How To Create Your Own SMS Link

To do this, we'll use the "a" HTML tag, which stands for anchor. Within the anchor tag, we'll add the "href" attribute and specify the format for an SMS link. The format looks like this:

<a href="sms:number&body=message">Send SMS</a>

Here's a breakdown of each part:

  • "sms:" is the protocol that specifies we're creating an SMS link
  • "number" is the recipient's phone number. Make sure to include the country code and no spaces or dashes. Example: "+18556743554".
  • "body=" is the text that will be pre-populated in the message field when the link is clicked. You can add your message after the "=" sign. Example: "body=Hey, just wanted to say hello!".
  • "Send SMS" is the text that will be displayed on the page as the link. You can change this to whatever you want, like "Text Us" or "Quick Message".

That's it! Now when a user clicks the link, it will open up their default SMS app and they can send the text with just a few taps. Cool, huh?

Here's an example of a complete SMS link (from our example earlier)

<a href="sms:+18556743554&body=Hey Roezan dudes, thanks for creating an awesome tutorial">Send An SMS Message</a>

Free Click To Text Widget From Roezan

We created a free click-to-text widget you can put on your website:

You can customize this to let your customers send you a message! 

Check out the widget and the code here.


And there you have it! Adding an SMS link to your website or web page is a fun and easy way to make things more interactive for your users.

Give it a try and see what you can come up with!

Search Pivot