How Social Networks Really Count Characters — and Why .length Gets It Wrong
A developer building a publishing API across 13 social networks found that character limits are measured differently depending on the platform, making JavaScript's native .length unreliable. Most major platforms including Facebook, Instagram, X, and LinkedIn measure UTF-16 code units, which happens to match .length — but Threads and Bluesky are notable exceptions. Bluesky enforces two simultaneous limits — 300 graphemes and 3,000 bytes — and a post must satisfy both, meaning emoji-heavy or non-Latin text can fail even when a simple character count looks safe. TikTok adds another wrinkle: its app permits up to 4,000 characters, but its Content Posting API rejects posts beyond 2,200, illustrating that the UI limit and the API limit can differ entirely. The key takeaway is that developers must identify the exact unit each API enforces and validate against that specifically, rather than relying on a single length check.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in