Text & Writing
How To Count Characters
Character limits are the hard constraints of writing online. Unlike a word count, which is a guide, a character limit truncates, rejects or splits your text the moment you cross it.
Quick Answer
characters = length of the string, including spaces
- chars
- Every character in the text, spaces included
- noSpaces
- The same text with all whitespace removed
- limit
- The maximum a platform accepts
The sample above is 154 characters, or 129 once the spaces are removed. That fits inside a 160-character meta description but overflows a 60-character SEO title by 94.
What Is How To Count Characters?
A character count is the length of a piece of text measured in characters rather than in words. Every letter, digit, punctuation mark, space and line break contributes one, so it is a stricter and more mechanical measure than a word count.
Spaces count. This is the single fact that catches people out, because a headline that looks comfortably short can cross a limit once the spaces between its words are included. Tools that report a count without spaces are answering a different question.
Character limits are everywhere online. An SEO title is truncated by search engines at roughly 60 characters, a meta description at about 160, an SMS segment at 160, an X post at 280, an Instagram caption at 2,200 and a LinkedIn post at 3,000.
The limits exist for different reasons. An SMS limit comes from the fixed size of a signalling message, a social limit is a product decision, and a search limit reflects how much of a title a results page will display before cutting it off with an ellipsis.
Being cut off is not the same as being rejected. A search engine quietly truncates a long title, while a form that enforces a limit may refuse to accept the text at all. Knowing which one applies tells you whether the limit is a target or a wall.
Counting gets subtle for characters outside the basic Latin set. A modern system stores text in UTF-8 on disk but measures length in UTF-16 code units in JavaScript, and the two disagree for anything above the basic multilingual plane.
An emoji such as a grinning face sits above the basic multilingual plane and takes two UTF-16 code units, so JavaScript reports it as two characters even though it looks like one symbol. A family emoji built from several joined characters can count as seven or more.
Accented letters are usually a single code point and therefore a single character, but a letter with a combining accent mark is two code points that render as one glyph. Whether that counts as one or two depends on whether the tool normalises the text first.
SMS is a special case worth knowing. A message written entirely in the GSM-7 alphabet fits 160 characters, but a single character outside that alphabet, such as a curly apostrophe or an emoji, switches the whole message to the smaller UCS-2 encoding and cuts the limit to 70.
Because of that switch, a single emoji can turn a 160-character message into three or four billed segments. The character count of the text has not changed much, but the cost of sending it has.
Line breaks count as characters too. A two-line caption contains a newline, which occupies a position in the string even though it prints as nothing. On some platforms a newline counts as two, because the underlying sequence is a carriage return and a line feed.
The relationship between characters and words is loose. English averages about five and a half characters per word including the space, but the ratio swings from four for short common words to nine or ten for technical vocabulary.
The calculator counts the characters with and without spaces, lists the words and lines, and checks the text against the common platform limits. Each limit shows how much room is left or how far over the text has run.
Formula
characters = number of code units in the string
The length of a string is the count of its code units, which includes spaces, punctuation and line breaks but counts an emoji as more than one.
| Symbol | Meaning | Unit | Notes |
|---|---|---|---|
| s | Text | string | The string being measured. |
| C | Character count | characters | How many code units the string contains. |
room left = limit - characters
Subtract the character count from the platform limit. A negative result is the number of characters by which the text overflows.
| Symbol | Meaning | Unit | Notes |
|---|---|---|---|
| L | Limit | characters | The maximum the platform accepts. |
| C | Character count | characters | How many code units the string contains. |
| R | Room left | characters | Positive if it fits, negative if it overflows. |
How To Calculate How To Count Characters
- 1
Count every character, spaces included
Walk the string and count each code unit. Spaces, commas, apostrophes and newlines all add one.
- 2
Count again without the spaces
Removing whitespace gives the shorter figure some tools report. It is useful for comparing density, not for checking a limit.
- 3
Pick the limit that applies
Use 60 for an SEO title, 160 for a meta description or an SMS, 280 for X, 2,200 for an Instagram caption and 3,000 for a LinkedIn post.
- 4
Subtract to find the room left
Take the limit minus the count. A positive number is spare room, a negative number is how far over the text has run.
- 5
Watch for characters outside the basic set
An emoji or an accented character outside the platform's alphabet can count as two, or can switch an SMS to the shorter encoding and cut the limit.
Examples
Example 1: A post against the 280-character limit
- Text
- a post that fills the limit
- Limit
- 280
| Step | Calculation | Result |
|---|---|---|
| Characters | count every code unit | 280 |
| Words | 280 / 5.5 | 51 |
| Room left | 280 - 280 | 0 |
Result: A 280-character post of about 51 words exactly fills the limit, leaving 0 characters of room.
Example 2: A meta description against the SEO title limit
- Text
- a meta description
- Limit
- 160
| Step | Calculation | Result |
|---|---|---|
| Characters | count every code unit | 160 |
| Words | 160 / 5.5 | 29 |
| Over the SEO title limit | 160 - 60 | 100 |
Result: A 160-character meta description is 29 words and runs 100 characters past the 60-character SEO title limit.
Calculator
Prefer a full-width tool? Open the How To Count Characters calculator page.
Common Mistakes
Forgetting that spaces count
A headline of twelve short words can pass 60 characters on the spaces alone. Count with spaces when the limit is about display width.
Using the count without spaces to check a limit
The no-spaces figure is useful for density comparisons, but every platform limit is measured with spaces included.
Assuming an emoji is one character
Most emoji sit above the basic multilingual plane and take two UTF-16 code units, so a row of them can blow a character budget far faster than it appears.
Ignoring the SMS encoding switch
One curly apostrophe or emoji moves a message from the 160-character GSM-7 alphabet to the 70-character UCS-2 encoding, multiplying the cost of the send.
Confusing truncation with rejection
A search engine cuts a long title silently while a form may refuse it outright. Know which behaviour you are designing for.
Overlooking the line break
A newline is a character, and on some platforms it is two. Multi-line captions are longer than the visible text suggests.
Padding a meta description to the full limit
Filling all 160 characters leaves no room for the search engine to rewrite the snippet. A slightly shorter description is often safer.
FAQ
How many characters is a tweet?
A standard post on X allows 280 characters, and every character counts, including spaces, links and emoji. A link is shortened to a fixed length regardless of how long the address is.
Why does an emoji count as two characters?
JavaScript measures string length in UTF-16 code units, and most emoji need two units because they sit above the basic multilingual plane. A few emoji built from several joined characters count as many more.
How long should a meta description be?
Around 155 to 160 characters, which is roughly where search engines stop displaying it. A description that is too long is truncated, and one that is too short wastes the space.
Why did my SMS suddenly split into more messages?
A single character outside the GSM-7 alphabet switches the whole message to the UCS-2 encoding, which holds only 70 characters per segment instead of 160. One emoji can therefore turn one message into three.
Does the character count include punctuation?
Yes. Every printable character counts, including full stops, commas, apostrophes and quotation marks. Only the platform can decide to ignore any of them.
Is a character the same as a byte?
No. In UTF-8 an English letter is one byte but an accented letter or an emoji takes two, three or four bytes. Character counts measure code units, while file sizes measure bytes.
References
- [1]Unicode Consortium, Character encoding and the Unicode Standard — https://www.unicode.org/standard/standard.html
- [2]Twilio, SMS character encoding and segmentation — https://www.twilio.com/docs/glossary/what-is-a-segment
- [3]Google Search Central, How Google creates titles and snippets — https://developers.google.com/search/docs/appearance/title-link