TransactionTree’s Text Message Character Limits & Concatenation Practices
What is the character limit for text messages?
The maximum number of characters per single message being sent to carriers depends on the encoding used, and the encoding used depends on the content of the message. The HTTP API limits SMS messages to a maximum length of 2048 characters.
- A message containing text characters only will be encoded using GSM-7
- A message containing emojis will be encoded using UCS-2
This table shows the maximum number of characters that can be sent in a single SMS segment to carriers.
How does TransactionTree send concatenated (long) messages?
Depending on the message content (plain text, emojis, special characters etc), TransactionTree will use either GSM-7 or UCS-2 encoding to send the messages and each encoding has limitations to the number of characters that can be sent. The limitations for a single segment are:
- 160 characters for GSM-7 (e.g. Latin-1/9 and GSM8)
- 70 characters for UCS-2 (e.g. message with emojis)
When you send a message whose text is longer than the maximum number of characters per segment, TransactionTree will automatically split the message for you, add a special header (User Data Header), and send multiple SMS to carriers.
What is a User Data Header?
The User Data Header (UDH) takes up 6 bytes and instructs the receiving device how to reassemble the segments so that your whole message will be shown as one SMS on the receiving handset. The maximum number of characters per concatenated (long) message is slightly reduced due to the inclusion of concatenation headers (UDH).
Can you explain the math?
Yes! Here are some important units to start with:
- SMS messages are sent in 140 bytes
- 1 byte = 8 bits
- In GSM encoding, 1 character = 7 bits
- In Unicode, 1 character = 16 bits
- UDH = 6 bytes
Now, let’s do some calculations.
Message Type | Calculation | Max Characters per Segment |
---|---|---|
GSM Single Segment | (140 bytes x 8 bits) / 7 bits | 160 characters |
GSM Multi Segment | ((140 bytes - 6 bytes) x 8 bits) / 7 bits | 153 characters |
Unicode Single Segment | (140 bytes x 8 bits) / 16 bits | 70 characters |
Unicode Multi Segment | ((140 bytes - 6 bytes) x 8 bits) / 16 bits | 67 characters |
TransactionTree and the industry as a whole, counts messages by segments; therefore, customers will be charged for each individual message segment sent to downstream carriers.
For example:
Characters used in message | Total number of characters | Encoding | Message Segments | Calculation |
---|---|---|---|---|
Text Only | 160 | GSM-7 | 1 | No UDH required, all 160 characters are available |
Text Only | 240 | GSM-7 | 2 | 153+87=240 characters |
Text and emojis | 150 | USS-2 | 3 | 67+67+16=150 characters |