When you create an SMS message, it is important to take into account the number of fragments contained in your message, as the cost of sending an SMS message is variable and dependent on the number of fragments needed to send the message. So, the more fragments, the higher the cost. The application will always try to send an SMS in the most effective manner, but ideally, an SMS should have one single fragment.


The number of fragments is based on both the length of the message and the encoding format used to send the message.

  • The GSM-x format accepts more characters than the UCS-2 format, but supports a limited range of characters.
  • When the format is variable, this means that the static content of the SMS supports GSM but that adding personalization elements might force the use of UCS-2.

Length of the SMS

Although the SMS protocol authorizes 160 characters, the actual number of accepted characters in a fragment depends on the client's SMS provider. For Twillio for instance, the number of fragments is of 140 per fragment when encoded in GSM format: https://www.twilio.com/docs/glossary/what-is-gsm-7-character-encoding

Consequently, adding a 141st character to a message will create a 2nd fragment (the first with 140 characters and the second with only 1 character), and double the cost of the SMS.

An SMS with 140 characters or less:

The same SMS with one extra character:

Encoding

When we say that an SMS authorizes 140 characters, we suppose that the standard GSM encoding is used where each character uses 1 byte.

However, certain special characters need 2 bytes. In this case, the complete message uses UCS encoding and therefore the number of possible characters becomes 70 instead of 140.

In the example below, the message has 124 characters, and uses GSM encoding (1 character = 1 byte, resulting in one fragment. However, adding a special character such as the copyright sign will change the encoding to UCS, where each character takes 2 bytes. The second message will account for 2 fragments as this number of characters (125) exceeds the 70 characters authorized by fragment in UCS encoding.

SMS with 1 single fragment:

The same SMS with one extra sign, encoded in UCS:


Personalization

If your message includes personalization elements, such as the name of the contact, the number of characters that can be contained in this field will be added to the maximum number of characters. 

Number of characters

Since the content of the field is only calculated when the message is sent, the analysis can only predict the minimum and maximum number of fragments that can contain the message.

This approximation takes into account two elements:

  • The number of characters
    The analysis shows the minimum of characters (if there is no value in the field) and the maximum number of characters in the field (which is 50 characters in the example below). 
  • The number of fragments
    The number of fragments is calculated individually for each contact based on the actual values contained in the field. The type of value determines the encoding format used. 
    • If the field contains no special characters, the GSM format will be used. In this format, each character accounts for 1 byte, and 1 fragment equals 140 characters.
    • If the field contains special characters, then the UCS format will be used. In this format, each character accounts for 2 bytes, thus reducing the number of characters per fragment to 70, instead of 140.


Example:

If you send an SMS to 100 contacts, some messages might be encoded in GSM and others in UCS, depending on whether the value found in the personalization field contains special characters or not. So, messages will not all have the same number of fragments.