Character Counter

Count characters with and without spaces, perfect for social media limits.

Related Tools

0 comments

How it works

Total characters use JavaScript's string length property, which counts UTF-16 code units — every visible character on screen counts as one (most emoji are surrogate pairs and count as two, which matches how Twitter counts them). The "without spaces" count strips whitespace via regex /\s/g before measuring. The tool checks your text against four well-known platform limits and shows a colored indicator when you approach or exceed each cap.


              totalChars = text.length
noSpaceChars = text.replace(/\s/g, "").length
            

Common use cases

  • Trimming a tweet to fit the 280-character X (Twitter) limit.
  • Sticking to a single SMS message (160 characters) to avoid multi-part charges.
  • Optimizing Instagram captions (2,200 max) and LinkedIn posts (3,000 max).

See also: Word Counter .

Frequently asked questions

Why does my emoji count as 2 characters?

Most emoji are encoded as UTF-16 surrogate pairs in JavaScript strings, so they take up two code units. Twitter, Instagram, and SMS gateways count the same way, so the number you see here matches what those platforms enforce.

What's the difference between "with spaces" and "without spaces"?

With-spaces matches the count most platforms enforce (Twitter, SMS). Without-spaces is sometimes requested by academic submissions or word-count-by-character requirements where whitespace shouldn't inflate the total.

Why is my SMS over 160 characters but still shows as one message?

The 160-character limit applies to GSM 7-bit encoding (basic Latin letters). If your message contains emoji or non-Latin characters, carriers switch to UCS-2 encoding which has a 70-character per-segment limit. This counter shows the simple GSM limit.