The Complete Guide to Character Counting for Writers and Developers

May 28, 2026

Why Character Counting Matters

Character limits are everywhere. Social media platforms cap your posts. Search engines truncate your titles and descriptions. Databases enforce field lengths. If you write or code for the web, knowing your character count is not optional โ€” it determines whether your message gets seen or cut off.

Writers lose engagement when tweets exceed 280 characters. Developers crash forms when input validation ignores length. SEO professionals waste effort when meta descriptions get clipped at 155 characters. Accurate character counting prevents all of these problems.

Character Limits Across Platforms

Every platform enforces its own restrictions. Here are the most common ones you will encounter:

PlatformFieldCharacter Limit
X (Twitter)Tweet280
X (Twitter)Display name50
InstagramCaption2,200
InstagramBio150
LinkedInPost3,000
LinkedInHeadline220
FacebookPost63,206
YouTubeTitle100
YouTubeDescription5,000
Google AdsHeadline30
Google AdsDescription90
SMSSingle segment160
App StoreApp name30
App StoreSubtitle30
Google PlayApp title30

These limits change over time. Always verify current limits directly from the platform's documentation before finalizing your content.

Character Count vs. Byte Count

These two measurements seem identical โ€” until you work with non-ASCII text. Understanding the difference prevents subtle bugs and silent truncation.

What Character Count Measures

Character count counts each visible unit of text. The letter "A" is one character. The emoji "๐Ÿ˜€" is one character. The Chinese character "ๅญ—" is one character. Most writing tools and social platforms use character count as their display metric.

What Byte Count Measures

Byte count measures how much storage the text occupies. The encoding determines the relationship:

CharacterUTF-8 BytesUTF-16 BytesCharacter Count
A121
รฉ221
ๅญ—321
๐Ÿ˜€441

A tweet with 140 emojis uses 280 characters โ€” but 560 bytes in UTF-8. A database VARCHAR(255) limit of 255 bytes can store 255 ASCII characters, but only 85 Chinese characters. This mismatch causes real failures.

When Byte Count Matters

  • Database columns: VARCHAR(n) limits refer to characters in MySQL when using utf8mb4, but some databases and ORMs apply byte limits.
  • API payloads: REST APIs may enforce byte limits on request bodies.
  • SMS segments: Messages exceeding 160 characters (or 70 characters with Unicode) split into segments, increasing costs.
  • File formats: Some binary formats reserve fixed byte widths for strings.

Always clarify whether a limit refers to characters or bytes before you build validation logic.

How to Count Characters on Different Systems

Your operating system gives you built-in tools for counting characters. No need to install anything for basic counting.

Windows

Word counts characters in its "Word Count" dialog (Ctrl+Shift+G). For plain text, open the file in Notepad, select all text (Ctrl+A), and check the status bar โ€” it shows the character position of your cursor, which equals the character count when the cursor is at the end.

PowerShell offers a quick command:

("Your text here").Length

For files:

(Get-Content file.txt -Raw).Length

macOS

The simplest method is the built-in terminal command wc:

wc -m file.txt

The -m flag counts characters (not bytes). Without it, wc -c counts bytes โ€” which gives different results for non-ASCII text.

Preview can also show character count. Open your document, then choose View > Show Word Count, and click the arrow on the counter to switch to character count.

Linux

Same wc command works on Linux:

wc -m file.txt

For inline text in scripts:

echo -n "Your text here" | wc -m

The -n flag prevents echo from adding a newline, which would inflate the count by one.

Common Pitfalls in Character Counting

Even experienced developers and writers make these mistakes:

  • Counting bytes instead of characters: Using .length on a byte array instead of a decoded string. In JavaScript, "๐Ÿ˜€".length returns 2 because JavaScript counts UTF-16 code units, not Unicode characters.
  • Ignoring invisible characters: Line breaks, tabs, and zero-width spaces all count. A 280-character tweet with 10 line breaks has room for 270 visible characters plus formatting.
  • Forgetting BOM: UTF-8 files with a Byte Order Mark add 3 bytes to the file size. This matters when enforcing strict byte limits.
  • Emoji variation: Some emojis render as a single glyph but consist of multiple code points. Skin-tone modifiers and ZWJ sequences (like family emojis) can span 6 or more UTF-16 code units.

For JavaScript specifically, use the spread operator or Array.from() to count actual Unicode characters:

// Wrong for emojis and surrogates
"๐Ÿ˜€".length // 2

// Correct
[..."๐Ÿ˜€"].length // 1
Array.from("๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ").length // correct family emoji count

Key Takeaways

  • Character limits exist on every major platform โ€” knowing them prevents your content from being silently trimmed.
  • Character count and byte count diverge for any text beyond basic ASCII. Always check which metric a platform or system uses.
  • Built-in OS tools (wc -m, PowerShell .Length) handle character counting without extra software.
  • JavaScript's .length property counts UTF-16 code units, not Unicode characters โ€” use Array.from() or the spread operator for accurate results.
  • Invisible characters (line breaks, tabs, zero-width spaces) count toward limits even though readers cannot see them.

Try It Yourself

Need to verify your character count before posting or committing? Paste your text into our free character counter and get an instant breakdown โ€” characters with and without spaces, byte size, word count, and line count.

Free Character Counter Tool