An SMS link is a URL that starts with sms: instead of https:. When someone taps it on a phone, the messaging app can open with the recipient's number and, optionally, a draft message already filled in. That saves your visitor from copying a number and typing the message by hand. Fill in the generator below to build one, then read on for the syntax and its limits.
SMS Link Generator
The link opens the messaging app on a phone with the number and text filled in. Use the international format with +.
Enter a phone number or a message to build the linkKey Takeaways
- 1Basic format from RFC 5724: sms:+15105550101?body=hello%20there
- 2Write the number in international form with a leading +, as RFC 5724 requires for global numbers
- 3Separate several recipients with commas: sms:+15105550101,+15105550102
- 4body is the only field RFC 5724 defines, and it may appear only once
- 5Percent-encode the body (encodeURIComponent turns a space into %20 and a line break into %0A)
The sms: URI Syntax
The sms: scheme is standardised in RFC 5724 (January 2010). This section walks through its three parts: the recipient list, the optional query with the body field, and the encoding rules for the message text.
sms-uri = scheme ":" sms-hier-part [ "?" sms-fields ]
scheme = "sms"
sms-hier-part = sms-recipient *( "," sms-recipient )
sms-recipient = telephone-subscriber ; defined in RFC 3966
sms-fields = sms-field *( "&" sms-field )
sms-field = sms-field-name "=" escaped-value
sms-field-name = "body" / sms-field-ext ; "body" MUST only appear onceThis is the formal grammar from section 2.2 of RFC 5724. It says that one or more recipients come after the colon, separated by commas, and that fields follow a single ? and are joined with &, just like a web query string.
The RFC gives three examples in section 2.5. The table below shows each one with what it means; all three use the international number format with a leading +.
| Example | Meaning |
|---|---|
sms:+15105550101 | One recipient, no prefilled text |
sms:+15105550101,+15105550102 | Two recipients; the same message goes to both |
sms:+15105550101?body=hello%20there | One recipient, message prefilled with "hello there" |
Phone number format
RFC 5724 takes its number format from the tel: scheme in RFC 3966. Section 2.3 says the number must be written in international form with the country code unless it only works inside one area or network, and that international numbers begin with +. Hyphens, dots and parentheses are allowed as visual separators but carry no meaning, so sms:+1-510-555-0101 and sms:+15105550101 are equivalent.
sms:+15105550101The generator above keeps a leading + and strips spaces, dashes and other non-digits, which gives you the compact form. If you paste a number with a (0) trunk prefix, it is removed as well.
Multiple recipients
Put a comma between numbers to address several people at once. RFC 5724 says user agents SHOULD support this and SHOULD show the full recipient list before sending. Whether a given phone opens a group thread or individual messages is up to the messaging app; we have not tested this across devices.
sms:+15105550101,+15105550102?body=Meeting%20moved%20to%203pmEncoding the Message Body
The body field holds the draft text. RFC 5724 states that it "consists of percent-encoded UTF-8 characters", and that all reserved characters in the text are percent-encoded. In practice that means you run the message through an encoder before putting it in the link.
| Character | Encoded | Note |
|---|---|---|
| Space | %20 | Used in the RFC 5724 example |
| Line break (LF) | %0A | What encodeURIComponent produces for \n |
| & | %26 | Unencoded, it would start a new field |
| ? | %3F | Reserved character in URIs |
| # | %23 | Unencoded, it would start a fragment |
| é | %C3%A9 | UTF-8 bytes, each percent-encoded |
Read the table as "what you type" versus "what goes in the URL". The ampersand and the hash are the two that break links most visibly, because they silently cut your message short.
Note on line breaks: unlike the mailto: specification, which defines line breaks as CRLF (%0D%0A), RFC 5724 does not say how a line break should be written. %0A is simply what encodeURIComponent produces for a newline. We have not tested how each messaging app renders it.
RFC 5724 also notes that the phone converts the text to an SMS character set before sending (usually the 7-bit GSM alphabet, or UCS-2), and may drop or convert characters that do not fit, in which case it must tell the user. Emoji and accented letters are valid in the URL, but how they arrive depends on the sending phone.
iOS and Android Behaviour
The RFC describes what a link means, but each operating system decides what to do with it. Here is what the platform documentation we could find says, and what it does not say.
| Source | What it documents |
|---|---|
| Apple URL Scheme Reference (archived) | sms:<phone> launches Messages; the phone part is optional (sms: alone opens Messages). This archived page says the URL must not include message text, and does not mention body. |
| Android Common Intents | sms:, smsto:, mms: and mmsto: with ACTION_SENDTO open a messaging app. In native code, the message text is passed as an intent extra (sms_body), not as a URL parameter. |
Neither page documents what a browser does with ?body= in a web link. Apple's page is archived and may not reflect current iOS. You may also come across advice to use &body= instead of ?body= on some iPhones; we found no Apple documentation for that form and have not tested it, so this guide and the generator follow RFC 5724 and use ?body=. Test your link on the devices your visitors use.
Adding an SMS Link to a Web Page
An SMS link is an ordinary anchor element with an sms: URL in its href. MDN lists sms: among the URL schemes the <a> element supports.
<a href="sms:+15105550101?body=Hi%2C%20I'd%20like%20to%20book%20a%20table">
Text us at +1 510-555-0101
</a>The link text shows the number itself, so visitors on a device without a messaging app can still read it and text you another way. The body was built with encodeURIComponent, which encodes the comma as %2C and the spaces as %20 but leaves the apostrophe as it is.
Building the link in JavaScript
function buildSmsLink(phone, message) {
// Keep a leading "+", drop spaces, dashes and other separators
const number = (phone.trim().startsWith('+') ? '+' : '') + phone.replace(/\D/g, '');
const body = message ? '?body=' + encodeURIComponent(message) : '';
return 'sms:' + number + body;
}
buildSmsLink('+1 (510) 555-0101', 'Running late.\nSee you at 7?');
// "sms:+15105550101?body=Running%20late.%0ASee%20you%20at%207%3F"This function mirrors what the generator does. Avoid URLSearchParams for the body: it writes spaces as +, which RFC 5724 does not define as a space, so a messaging app could show literal plus signs.
sms: vs tel:
Both schemes use the same phone number syntax from RFC 3966, so it is easy to mix them up. The difference is what happens on tap, as the comparison below shows.
| tel: | sms: | |
|---|---|---|
| Opens | The phone dialer or a calling app | The messaging app |
| Specification | RFC 3966 | RFC 5724 |
| Multiple numbers | No | Yes, comma-separated |
| Prefilled content | No | body field |
| Example | tel:+15105550101 | sms:+15105550101?body=Hi |
You can offer both side by side. See the tel: protocol reference for the calling side.
Desktop Behaviour and Accessibility
SMS links are built for phones, but they are also shown on laptops and desktops. What happens there depends on which app, if any, has registered itself for sms: links on that computer.
On a desktop with no registered handler, clicking the link may do nothing at all, or the browser may show a prompt asking which app to use. On a computer linked to a phone (for example through a messaging or phone-companion app) the link may open that app instead. We have not tested specific desktop setups, so do not rely on the link being the only way to reach you.
Make the number visible
Put the phone number in the link text, not just "Text us". Visitors without a messaging app can still copy it, and screen reader users hear where the link goes.
Say what the link does
A label such as "Text +1 510-555-0101" tells people a messaging app will open, rather than a web page.
Don't send a message without consent
The body is only a draft. RFC 5724 describes it as the starting point for message composition, which the user can still edit or cancel.
If the people you want to reach mostly use a chat app rather than SMS, the same idea works with a WhatsApp click-to-chat link.