> For the complete documentation index, see [llms.txt](https://docs.localmail.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.localmail.io/messaging/learn-more-about-sms/what-is-gsm-7-character-encoding.md).

# GSM-7

GSM-7 is a character encoding standard which packs the most commonly used letters and symbols in many languages into 7 bits each for usage on GSM networks. As SMS messages are transmitted 140 8-bit octets at a time, GSM-7 encoded SMS messages can carry up to 160 characters.

### GSM-7 Encoding Quirks <a href="#gsm-7-encoding-quirks" id="gsm-7-encoding-quirks"></a>

GSM-7 is the standard alphabet for SMS messages, written up in the standard [GSM 03.38](http://www.etsi.org/deliver/etsi_gts/03/0338/05.00.00_60/gsmts_0338v050000p.pdf). It is always supported on [GSM](https://en.wikipedia.org/wiki/GSM) networks. In languages with more than 128 commonly used symbols, GSM-7 is mandated. However, local language support is implemented with shift tables or by changing text encoding to (16-bit) [UCS-2](https://docs.localmail.io/messaging/learn-more-about-sms/what-is-ucs-2-character-encoding) encoding.

The basic character set for GSM-7 [can be found here](https://en.wikipedia.org/wiki/GSM_03.38#GSM_7-bit_default_alphabet_and_extension_table_of_3GPP_TS_23.038_.2F_GSM_03.38).

For some characters, such as '{' and ']', an escape code is required - so even in a GSM-7 encoded message these characters will be encoded using two characters.

SMS messages contain 140 8-bit octets, so up to 160 GSM-7 characters may be transmitted: (140\*8)/7 = 160.

### How Localmail Encodes Your Messages <a href="#how-twilio-encodes-your-messages" id="how-twilio-encodes-your-messages"></a>

When sending SMS messages with Localmail, we'll automatically send messages in the most compact encoding possible. If you include *any* non GSM-7 characters in your message body, we will automatically fall back to [UCS-2](https://docs.localmail.io/messaging/learn-more-about-sms/what-is-ucs-2-character-encoding) encoding (which will limit message bodies to 70 characters each).

Additionally, for long messages--greater than 160 GSM-7 characters or 70 UCS-2 characters--Localmail will split the message into multiple segments. Localmail also prepends a [User Data Header](https://en.wikipedia.org/wiki/User_Data_Header) of six (6) Bytes to instruct the receiving device on how to re-assemble messages. For multi-segment messages, this leaves **153 GSM-7 characters** or **67 UCS-2 characters** per segment.

Note that this may cause more message segments to be sent than you expect - a body with 152 GSM-7-compatible characters and a single unicode character will be split into three (3) messages because the unicode character changes the encoding into less-compact UCS-2. This will incur charges for three outgoing messages against your account.

**How Do I Check if My Message Can Be Encoded in GSM-7?**

[This page](https://localmail.github.io/message-segment-calculator/) contains an interactive tool which can check if encoding your message in GSM-7 is possible, or if UCS-2 is needed.

**How Can I Avoid My Messages Being Split When I Expect Them to be in GSM-7?**

Unfortunately, GSM-7 is not a supported character encoding in many text editors. Even setting encoding to ASCII (or US\_ASCII, or UTF-8) will not guarantee that text you write will be limited to GSM-7. You can use the  [linked tool](https://localmail.github.io/message-segment-calculator/) to quickly check the number of segments - that is, total messages - some text will be divided into.

If you are writing in an editor with Unicode support you'll need to be particularly careful. Text editors designed for writing might automatically add angled smart quotes, non-standard spaces, or punctuation which looks similar to GSM-7 but is a different Unicode character.&#x20;

### Need More Help?

If you need any further Help During your Integration or questions related to technical know-how, you can reach out to our support team at **<support@localmail.io>**


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.localmail.io/messaging/learn-more-about-sms/what-is-gsm-7-character-encoding.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
