String Length Calculator

Count characters, bytes, and code units exactly the way programming languages do.

Characters

0

What you see on screen

Without spaces

0

Bytes (UTF-8)

0

Size when saved or sent

UTF-16 length

0

JavaScript / Java / C# length

Code points

0

Python len()

Words

0

Lines

0

Letters

0

Digits

0

Spaces

0

String Length Calculator

Find out exactly how long a piece of text is. Paste any string and instantly see the number of characters, bytes, words, and lines – including the different "lengths" used by programming languages.

Why string length is tricky

A single emoji like 👋🏽 looks like one character, but it is 2 code points, 4 UTF-16 units, and 8 UTF-8 bytes. That's why a string can pass validation in the browser and still be rejected by a database or API. This calculator shows every measure side by side:

  • Characters – user-perceived characters (grapheme clusters).
  • UTF-16 length – str.length in JavaScript, Java, C#, and Kotlin.
  • Code points – len(str) in Python 3 and CHAR_LENGTH in MySQL.
  • UTF-8 bytes – storage and network size, used by many API limits.

Everyday uses

Check the length of meta titles and descriptions, tweets, SMS messages, passwords, form fields, and database values before you hit a limit. For a word-focused count, try the Word Counter.

Frequently Asked Questions

Computers can count text in several ways. 'Characters' counts what a person sees (grapheme clusters). JavaScript, Java, and C# count UTF-16 code units, where most emoji take 2 units. Python counts Unicode code points. Databases and APIs often limit the UTF-8 byte size, where accented letters take 2 bytes and emoji take 4.

MySQL VARCHAR(n) with utf8mb4 and PostgreSQL VARCHAR(n) count characters (code points), while byte limits (for example index limits or some APIs) use the UTF-8 byte count.

Yes. 'Characters' includes spaces and line breaks. Use 'Without spaces' if you need the count excluding all whitespace.