Character Counter
Detailed character analysis — with and without spaces, letters, digits, special chars.
About the Character Counter
The Character Counter decomposes your text into categories that matter when you are fighting for every byte: total characters, characters excluding whitespace, letters (split into uppercase and lowercase), digits, whitespace, and everything else (punctuation, symbols, emoji). For anyone working under a hard character ceiling — SMS marketers, Twitter/X power users, meta description writers — knowing the exact breakdown is the difference between a message that fits and one that gets truncated.
Plain word counters tell you “280 characters,” but they do not tell you that 40 of those characters are spaces you could collapse. This tool shows you the raw material so you can edit intelligently. A tweet with 270 characters including 50 spaces has 220 characters of actual content.
The tool also reports UTF-8 byte length, which matters for database column limits (VARCHAR(255) in MySQL with utf8mb4 stores up to 1,020 bytes) and for SMS encoding (GSM-7 packs 7 bits per character for 160 per segment, UCS-2 uses 16 bits per character for 70 per segment).
How It Works
The analyzer runs six independent regular expressions across your text. /[a-zA-Z]/g matches ASCII letters; /[0-9]/g matches digits; /[A-Z]/g and /[a-z]/g split letters into cases; /\s/g matches whitespace. The “special” category is non-whitespace minus letters minus digits, capturing punctuation, symbols, currency signs, and non-ASCII characters.
Total characters come straight from String.length, which counts UTF-16 code units per the ECMAScript Language Specification (ECMA-262). For emoji and supplementary-plane scripts that require surrogate pairs (such as CJK characters), the count reflects code units rather than grapheme clusters — the same convention used by Twitter and most programming languages.
UTF-8 bytes come from new TextEncoder().encode(t).length, the modern Web API for converting a JavaScript string to its UTF-8 byte representation. This is the number you want when sizing a database column, an HTTP header, or an SMS payload — the byte count can be up to four times the character count for CJK or emoji-heavy text.
Worked Examples
The default text “Hello, World! 123 @#$ - let's count every character precisely.” produces 57 total characters, 48 without spaces, 33 letters (2 uppercase, 31 lowercase), 3 digits, 9 whitespace characters, and 12 special characters. Knowing that 12 of 57 characters are non-alphanumeric tells you the message is unusually symbol-heavy, which can affect SMS encoding — an emoji forces the entire message into UCS-2 and cuts the per-segment limit from 160 to 70 characters.
If you paste a typical tweet, you will usually see a roughly 80/20 split between letters and spaces plus punctuation. The 10-15 percent whitespace ratio is what makes English text readable; compress it below 8 percent and you risk looking like a spam bot.
For a meta description, watch the total character count closely. Google truncates around 160 characters on desktop and 120 on mobile. If your description is 158 characters with 22 spaces, the no-spaces count of 136 tells you the snippet will look complete on desktop and slightly truncated on mobile.
When to Use This Tool
- Writing SMS messages that must stay under 160 characters (GSM-7) or 70 characters (UCS-2 for emoji).
- Crafting Twitter/X posts that respect the 280-character limit including emoji and Unicode.
- Composing meta descriptions under 155 characters for Google search snippets.
- Writing page titles under 60 characters so they are not truncated in SERPs.
- Detecting symbol-heavy text that may be flagged by spam filters or trigger UCS-2 SMS encoding.
- Validating password composition (minimum letters, digits, special characters) for security policy enforcement.
- Estimating UTF-8 byte size for database VARCHAR columns and API payload limits.
Limitations & Disclaimer
This tool counts UTF-16 code units via String.length, which may overcount emoji and supplementary-plane characters that require surrogate pairs. The “letters” category matches only ASCII letters ([a-zA-Z]); accented letters are counted as “special” rather than letters. For Unicode-aware letter detection, a script-based regex like /\p{L}/gu would be needed. See our disclaimer for full terms. For related tools, see the Word Counter and Case Converter.
Frequently Asked Questions
Why does my emoji count as two characters?
JavaScript's String.length counts UTF-16 code units. Most emoji require a surrogate pair, which is two code units. Complex emoji (family emoji using ZWJ sequences) can count as 7 or more. For grapheme-cluster counting, you would need Intl.Segmenter (available in modern browsers).
What is the difference between GSM-7 and UCS-2 encoding?
GSM-7 packs 7 bits per character, allowing 160 characters in a single SMS segment. UCS-2 uses 16 bits per character, allowing only 70 characters per segment, but supports any Unicode character. Including a single emoji forces the entire message into UCS-2.
Does the tool count line breaks as characters?
Yes. Each line break counts as one character on Unix (newline) or two on Windows (carriage return plus newline). The browser normalizes Windows line endings to a single newline when reading from a textarea.
Can I use this to count bytes for a database column?
Use the UTF-8 bytes figure shown in the results. String.length counts UTF-16 code units, not UTF-8 bytes, so it undercounts CJK and emoji text. A MySQL utf8mb4 VARCHAR(255) column stores up to 1,020 bytes - check the byte count, not the character count, when sizing columns.
How does this differ from a word counter?
A word counter groups characters into words (splitting on whitespace) and counts the groups. A character counter counts individual characters and classifies them by type. Word count matters for reading level estimates and editorial limits; character count matters for SMS, tweets, meta tags, and database column limits.
Is my text sent to a server?
No. All analysis happens in your browser using JavaScript. Your text never leaves your device, which makes the tool safe for confidential or sensitive content.
Last updated: September 9, 2026 · Author: HT99 Tools Editorial Team