> ## Documentation Index
> Fetch the complete documentation index at: https://docs.brudcast.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Writing SMS content

> How characters become segments, which characters count double or switch the encoding, the 4-segment limit, and the opt-out footer.

export const Loop = ({id, src, alt, caption}) => {
  if (!src) {
    return <Placeholder id={id} kind="loop" label="Animation coming soon" description={alt} icon={<PlayIcon />} />;
  }
  return <figure className="brd-media" data-media-id={id}>
      <video className="brd-media-frame" src={src} autoPlay muted loop playsInline aria-label={alt} />
      {caption && <figcaption className="brd-media-caption">{caption}</figcaption>}
    </figure>;
};

SMS is plain text, and you pay per segment. A few characters can double the cost of a message
without you noticing. This page explains how the count works so you can keep it down.

## How segments work

A message that fits in one segment is sent as one. A longer message is split into parts, and each
part holds a little less, because it carries a header that joins the parts back together on the
phone.

| Encoding | Used when                                            | One segment    | Each segment when split |
| -------- | ---------------------------------------------------- | -------------- | ----------------------- |
| GSM-7    | Every character is in the standard SMS character set | 160 characters | 153 characters          |
| UCS-2    | Any other character is present                       | 70 characters  | 67 characters           |

## The live counter

Under the **Message** field in the campaign composer, a counter shows the characters and the
segments that will be billed, for example "142 characters · 1 segment billed". It includes the
opt-out footer.

* When the message needs UCS-2, the counter adds "unicode so segments hold 70 characters".
* When the message goes past the limit, it turns red and says "over the 4-segment limit, shorten
  the message".

<Loop id="lp-sms-writing-sms-content-counter" alt="Typing an emoji into the SMS message field, and the counter changing from 1 segment to 2 segments with the unicode note" />

## Characters that change the count

### Characters that count as two

These are in the GSM-7 set but each takes the space of two characters:

```text theme={"system"}
^  {  }  \  [  ~  ]  |  €
```

So 80 euro signs fill a whole 160-character segment.

### Characters that switch the whole message to UCS-2

One character outside the GSM-7 set switches the entire message to UCS-2, and every segment then
holds 70 characters instead of 160. Common causes:

* **Emoji.** An emoji usually takes the space of two characters, and some take more. Brudcast never
  splits an emoji across two segments.
* **Curly quotes and long dashes** (’ “ ” —), which word processors insert automatically. The
  straight versions (' " -) are in the GSM-7 set.
* **Many accented letters.** Some are in the GSM-7 set, such as é and ü. Many aren't, such as á and ó.
* **Most non-Latin scripts.**

<Tip>
  Type the message directly into the composer, or paste it from a plain-text editor, and watch the
  counter for the unicode note.
</Tip>

## The 4-segment limit

A campaign message can be up to 4 segments. That's 612 characters in GSM-7, or 268 in UCS-2.

The composer warns you when the message goes over. The limit also applies after merge tags are
filled in for each recipient: if a long value pushes one recipient's message past 4 segments, that
message fails with "too many segments".

## The opt-out footer

Every campaign message ends with "Reply STOP to opt out", added after a space. If your message already
contains that exact phrase, it isn't added a second time.

The footer counts toward your segments. It adds 22 characters, so a 150-character message becomes
172 characters: 2 segments instead of 1. A note under the **Message** field reminds you of this.

See [Opt-out keywords](#opt-out-keywords) for what happens when someone replies.

## Opt-out keywords

When a recipient replies with an opt-out keyword, Brudcast stops sending them SMS from that sender
ID. You don't have to do anything to honour it, and you can't override it.

| The recipient replies                                       | What happens                               |
| ----------------------------------------------------------- | ------------------------------------------ |
| `STOP`, `STOPALL`, `UNSUBSCRIBE`, `CANCEL`, `END` or `QUIT` | The number is opted out                    |
| `START`, `YES` or `UNSTOP`                                  | The number is opted back in                |
| `HELP` or `INFO`                                            | Recognized, but no automatic reply is sent |

Brudcast reads only the first word of the reply, and case and punctuation don't matter. `stop`,
`Stop.` and `STOP please` all opt the number out. `Please stop` doesn't, because the first word is
"Please", and neither does a keyword buried in a sentence, since searching every sentence for "stop"
would opt out people who never asked to.

* The number shows **Opted Out** on the contact (`opted_out` in the API). Campaigns skip it, it isn't
  counted in the reach, and it isn't charged.
* Brudcast checks again just before each message goes out, so a reply that arrives during a campaign
  stops the messages still waiting to be sent.
* An opt-out covers SMS only. The contact's email and other channels are unaffected.
* Only the recipient can opt back in. Changing the contact's SMS status in Brudcast doesn't lift an
  opt-out, because it's an instruction from the recipient, not a setting your organization owns.
* A reply carries only the recipient's number and the sender ID it was sent to, so when more than one
  organization uses the same sender ID, the opt-out applies to all of them. That's one more reason to
  register a sender ID based on your own brand.

Brudcast recognizes `HELP` and `INFO` but doesn't answer them, so if recipients may need help, put a
way to reach you in the message itself.

## Merge tags

Merge tags such as `{{ first_name }}` are filled in for each recipient when the message is sent.
A tag with no value for a contact is left empty.

The cost estimate counts each tag as a fixed width, so a long value can still push a message into
another segment. Budget for your longest likely value, not the average. See
[Placeholders and merge tags](/templates/placeholders-and-merge-tags).

## Structure that works

* **Lead with your brand.** A message that doesn't say who it's from reads as spam.
* **One message, one action.** Say one thing and give one link.
* **Keep links short.** A long link can cost a segment on its own.

## Related

<Columns cols={2}>
  <Card title="What a send costs" icon="coins" href="/channels/sms/overview#what-a-send-costs">
    How segments become credits.
  </Card>

  <Card title="Send your first SMS" icon="send" href="/channels/sms/send-your-first-sms">
    Put your message into a campaign.
  </Card>

  <Card title="Write content per channel" icon="layers" href="/campaigns/write-content-per-channel">
    How the SMS block fits with other channels.
  </Card>
</Columns>
