This tool measures the length of any text in multiple units simultaneously: Unicode characters (what most people mean by "characters"), UTF-8 bytes (what databases and APIs count), UTF-16 code units (what JavaScript counts), words, lines, and more. Different systems count string length differently — this tool shows all counts at once so you can use the right number for your context. Built by Bharath S, Software Engineer.
For Developers: String Buffer Sizes and API Limits
When working with strings in code, the "length" depends entirely on the encoding your system uses:
JavaScript/TypeScript:str.length returns UTF-16 code units. Most ASCII characters = 1 unit. Emoji and rare Unicode characters = 2 units (surrogate pairs). Use Array.from(str).length for true character count.
MySQL VARCHAR/TEXT: Byte length in UTF-8. Latin characters = 1 byte; most European + Cyrillic = 2 bytes; CJK characters = 3 bytes; emoji = 4 bytes. A VARCHAR(255) stores 255 bytes, not 255 characters.
PostgreSQL TEXT: Counts Unicode characters (code points), not bytes. More permissive than MySQL for multibyte text.
Python:len() returns Unicode code points in Python 3. In Python 2, it returned bytes — a common source of encoding bugs.
REST API payload limits: Typically enforced in bytes. A 10KB limit means 10,240 bytes — use the "UTF-8 bytes" count in this tool, not the character count.
For SEO: Character Limits That Affect Rankings
Search engines truncate text at specific character counts. Paste your content here to verify it stays within limits:
Google title tag: Truncates at ~50–60 characters (580px pixel width). Aim for 50–60 characters to avoid truncation in SERPs.
Google meta description: Truncates at ~155–160 characters on desktop, ~120 characters on mobile. Keep under 155 characters.
Google Search snippet: Up to ~250 characters for featured snippets.
Bing title tag: Approximately 65 characters.
For Social Media: Platform Character Limits
X/Twitter post: 280 characters (URLs count as 23 characters regardless of length)
LinkedIn post: 3,000 characters (first 210 shown before "see more")
Instagram caption: 2,200 characters (first 125 shown in feed)
Facebook post: 63,206 characters
YouTube title: 100 characters (first 70 visible in search)
YouTube description: 5,000 characters (first 200 shown without expansion)
For Database Design: Column Size Planning
Use the byte count from this tool when sizing VARCHAR columns:
Email addresses: Max 254 characters per RFC 5321. VARCHAR(254) in UTF-8 = 254 bytes.
URLs: Maximum practical length is 2,083 characters (IE limit). VARCHAR(2048) is a common safe choice.
Names: VARCHAR(100) is safe for full international names including honorifics.
SMS messages: 160 characters for pure ASCII, 70 characters for Unicode (non-ASCII) per segment.
Frequently Asked Questions
What is the difference between character count and byte length?
Character count is the number of visible characters, while byte length measures storage size in UTF-8 encoding where non-ASCII characters use 2-4 bytes each.
Why is UTF-16 length different from character count?
UTF-16 length matches JavaScript's .length property, which counts surrogate pairs (like emojis) as 2 units instead of 1 character.
How are words counted?
Words are counted by splitting text on whitespace, so any sequence of non-space characters separated by spaces, tabs, or newlines counts as one word.
Does this tool count emoji characters correctly?
Yes. This tool uses the Unicode-aware spread operator to count emoji as single characters, unlike JavaScript's built-in .length which counts many emoji as 2 due to UTF-16 surrogate pairs.
How do I check string length for a database column?
Use the UTF-8 Bytes count for databases using UTF-8 encoding (most modern databases), or the Characters count for databases configured with character-based limits like PostgreSQL VARCHAR(n).
What is URL-encoded length used for?
URL-encoded length tells you how many characters your string will occupy when placed in a URL query parameter. Non-ASCII characters and special characters are percent-encoded, making the URL-encoded version significantly longer than the original.
Why is JavaScript string length different from character count?
JavaScript's str.length returns UTF-16 code units. For characters in the Basic Multilingual Plane (most text), this equals the character count. However, emoji, certain rare Unicode characters, and symbols outside BMP use two code units (surrogate pairs), so str.length counts them as 2. Use Array.from(str).length for the true character count.
What is the difference between character count and byte count?
Character count = the number of Unicode code points (what humans count as characters). Byte count = how much memory/storage space the string uses. In UTF-8, ASCII characters use 1 byte each, most European and Cyrillic characters use 2 bytes, CJK characters use 3 bytes, and emoji use 4 bytes. APIs and databases typically enforce byte limits, not character limits.
How many bytes does an emoji use?
In UTF-8 encoding, most emoji use 4 bytes. A single emoji like 😊 counts as 1 character but 4 bytes. This matters for database VARCHAR limits (which are byte-based in MySQL), API payload limits, and SMS messages (where non-ASCII characters reduce the per-segment character limit from 160 to 70).