Quick answer: A string length calculator counts the characters in a piece of text — letters, digits, spaces, punctuation, and emoji. Paste your text above, click Count Characters, and the result appears instantly. Counts are computed locally in your browser; nothing is sent to a server.
When to use a length checker
- Social media limits — Twitter/X 280, Bluesky 300, LinkedIn 3,000, Mastodon 500.
- SMS limits — 160 characters per message (single SMS); longer texts split into multiple billable parts.
- SEO meta tags — title 50–60 chars, meta description 150–160 chars before truncation.
- Form validation — checking input fits a database
VARCHAR(N)column or API parameter limit. - Password policies — confirming a generated password meets minimum-length requirements.
- Coding interviews and homework — counting characters quickly without opening a code editor.
- Translations and copywriting — keeping translated text within UI button width or print column constraints.
String length vs. string size
These two terms sound interchangeable but mean different things:
| Term | What it counts | Example for "café" |
|---|---|---|
| Length | Characters / code units | 4 |
| Size | Bytes when UTF-8 encoded | 5 (é = 2 bytes) |
| Word count | Whitespace-separated tokens | 1 |
This page reports length. For UTF-8 byte size, use the String Size Calculator. For word count, use the Word Counter.
Examples
| Input | Length | Notes |
|---|---|---|
| Hello | 5 | Plain ASCII |
| Hello world | 11 | Space counts |
| café | 4 | Accented "é" = 1 character |
| 👍 | 2 | Emoji = surrogate pair |
| 中文 | 2 | Each CJK char = 1 code unit |
| a\nb | 3 | Newline counts as 1 |
How character counting works
The browser exposes string length via the .length property,
which counts UTF-16 code units. For text in the Basic Multilingual Plane
(most letters, digits, common punctuation, and CJK ideographs), one code
unit equals one character. For characters outside that plane (most emoji,
ancient scripts, mathematical symbols), the character is encoded as a
surrogate pair — two code units — so length reports 2 even though
the user sees one symbol.
This matters when validating against length limits in APIs that count the
same way (Twitter/X, MySQL VARCHAR, JavaScript). If you need a
"user-perceived" count (graphemes), the rules are more complex —
a single emoji can combine 4–7 code points (e.g. family emoji, skin tone
modifiers).
Doing it in code
JavaScript
"Hello world".length // 11
"café".length // 4
"👍".length // 2 (surrogate pair)
[..."👍"].length // 1 (code points) Python
len("Hello world") # 11
len("café") # 4
len("👍") # 1 (Python uses code points) Bash
echo -n "Hello world" | wc -m # 11 (characters, locale-aware)
echo -n "Hello world" | wc -c # 11 (bytes, ASCII) Related tools
- String Size Calculator — bytes / KB / MB
- Word Counter — count words, sentences, paragraphs
- Remove Whitespace — strip spaces before counting
- Remove Empty Lines — clean up multiline text
- All String Tools
Frequently asked questions
What does string length mean?
String length is the count of characters in a piece of text — including letters, digits, spaces, punctuation, and special characters. The string "Hello world" has length 11 (10 visible characters plus 1 space).
Does this tool count spaces?
Yes. Every character is counted, including spaces, tabs, and newlines. If you need length without spaces, paste the text into our Remove Whitespace tool first, then run the length checker on the cleaned text.
How does string length differ from string size in bytes?
Length counts characters; size counts bytes. For pure ASCII text they are equal (1 char = 1 byte). For UTF-8 text they differ: "café" is 4 characters but 5 bytes (because "é" is 2 bytes). Use this tool for length; use the String Size Calculator for byte size.
Why do emoji count as 2 characters?
JavaScript, Java, and many other languages count string length using UTF-16 code units. Emoji and rare CJK characters live outside the basic plane and use 2 code units (a surrogate pair). So 👍 has .length = 2 even though it's visually one character. This matches what most APIs report.
What's the maximum string length?
Browser JavaScript can handle strings up to roughly 1 billion characters before hitting platform limits, but UI rendering slows down well before that. This tool comfortably handles documents of millions of characters.
Where is this length checker useful?
Common use cases: meeting Twitter/X 280-char limit, SMS 160-char limit, meta description 155-char limit, password length policies, database VARCHAR column sizing, form input validation, blog post length targets, and counting characters in form fields that lack a built-in counter.
Is this faster than counting in Word or Google Docs?
Yes. This tool gives an instant count the moment you paste — no need to open Word, navigate to Tools → Word Count. It also works on phones and tablets where document editors are slower.