SMS length calculator

Count the way a carrier counts: by septets and code units, not by characters. One character in the wrong alphabet is the difference between one segment and three.

1
Segments
GSM-7
Encoding
47
Characters
47
Septets used
113
Left in this segment
$0.0069
Cost, US

One segment. 113 more septets before this becomes two, at which point the budget drops to 153 each.

Nothing you type leaves your browser.

How SMS length is actually counted

A text message carries 140 bytes. Everything below follows from that one number.

GSM-7: 160, then 153

The default alphabet packs seven bits per character, so 140 bytes hold 160 of them. Past that the message is split and each part gives up seven septets to the header that reassembles it, leaving 153.

UCS-2: 70, then 67

Any character GSM-7 does not have forces the whole message into 16-bit UCS-2: 140 bytes hold 70 units, or 67 once concatenated. Amharic, Arabic, Chinese and every emoji land here.

The characters that cost two

These exist in GSM-7 only as an escape sequence, so each one costs two septets instead of one. It is why a message of exactly 160 characters can still be two segments.

^{}\[~]|€

Square brackets, curly braces, the backslash, the caret, the tilde, the pipe and the euro sign. A URL with a tilde in it, or a price in euros, quietly costs double.

The mistake that costs the most

A curly apostrophe. A word processor inserts it without asking, GSM-7 has no room for it, and the budget for the whole message drops from 160 characters to 70.

Paste the message above and watch the encoding change. If it says UCS-2 and you did not mean to write in a non-Latin script, the offending characters are named for you.

What a segment costs

Every segment is billed as a message, which is why this matters. US SMS is $0.0069 a segment, plus carrier surcharges at cost. African rates are published per country, because one number across the continent would be a fiction.

Every price About the SMS API

Questions

How many characters is one SMS?

160 in GSM-7, the default alphabet. If the message needs UCS-2, because it contains a character GSM-7 has no room for, one message is 70 characters.

Why does my 160-character message count as two segments?

Either it contains an escape character such as a square bracket, a curly brace, a tilde or a euro sign, each of which costs two septets rather than one, or it contains a character outside GSM-7 entirely and the whole message became UCS-2.

Why is a concatenated message 153 characters and not 160?

A long message is sent as several ordinary messages with a small header, the UDH, that tells the handset how to put them back together. That header takes six bytes out of every segment, which is seven septets, leaving 153 in GSM-7 and 67 in UCS-2.

Do emoji count as one character?

To a person, yes. To the network, an emoji forces UCS-2 and most emoji cost two code units, not one, because they sit outside the Basic Multilingual Plane. One emoji can take a 70-character budget down to 68.

Does a curly quote really double the price?

It can. A word processor replaces a straight apostrophe with a curly one, which GSM-7 does not have, so the whole message becomes UCS-2 and the budget falls from 160 to 70. A 150-character message that was one segment becomes three.

Count it in code instead

The API answers the same question, free and unmetered, so a form can show the count as someone types.

curl -X POST https://api.woyra.io/v1/messages/preview \
  -H "Authorization: Bearer $WOYRA_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"body": "Your code is 483920"}'
Get a test key
SMS length calculator: characters, segments and what they cost · Woyra