Skip to main content

Character Counter

Count characters, words, sentences, lines, and UTF-8 bytes of any text as you type.

Written by Golam Rabbani, Founder & Lead Engineer

How to use this character counter

  1. Type or paste your text into the "Your text" field.
  2. Watch the six live stat cards update instantly as you type.
  3. Compare Characters against Characters (no spaces) to see whitespace volume.
  4. Press "Copy summary" to copy all six counts to your clipboard as a single line.
  5. Press Reset to clear the text and return all counters to zero.

About this character counter

The character counter delivers six live metrics the moment you start typing: total characters, characters without spaces, words, sentences, lines, and UTF-8 bytes. All counts update on every keystroke with no submit button required.

Each metric is measured differently. Character count is the JavaScript string length — technically UTF-16 code units — so emoji that sit outside the Basic Multilingual Plane occupy a surrogate pair and count as 2. Bytes, by contrast, uses the browser's TextEncoder to produce the true UTF-8 encoded length, which is what most databases, HTTP libraries, and APIs actually measure. Words are counted by splitting on any run of whitespace, sentences by splitting on one or more occurrences of `.`, `!`, or `?`, and lines by splitting on newline characters.

A concrete example: the string `Hello 🌍` has 7 characters (the globe emoji is a surrogate pair counted as 2 by `.length`), 6 visual graphemes, and 10 UTF-8 bytes (5 ASCII bytes plus the 4-byte UTF-8 encoding of U+1F30D). This distinction matters when sizing a database VARCHAR column (bytes), writing a tweet or SMS (characters), or crafting an SEO meta description, where the standard target is 160 characters.

The tool is useful for developers checking HTTP body limits, writers hitting word counts for essays or articles, and content editors keeping meta descriptions and social posts within platform limits. Everything runs locally in your browser — no text is ever sent to a server.

FAQ

Why does the character counter show a different number than the byte count?
Character count is the JavaScript string length measured in UTF-16 code units, while byte count is the UTF-8 encoded length. ASCII characters are 1 byte each, but characters outside the Basic Multilingual Plane (many emoji and rare Unicode symbols) are 4 bytes in UTF-8 and 2 code units in UTF-16, so the two counts diverge whenever those characters are present.
What counts as a word in this tool?
A word is any non-empty run of characters separated by whitespace (spaces, tabs, or newlines). Leading and trailing whitespace is trimmed before splitting, so extra spaces at the start or end of your text do not produce phantom words.
How does the tool detect sentences?
Sentences are split on one or more consecutive period, exclamation mark, or question mark characters. Any resulting segment that contains at least one non-whitespace character is counted as a sentence. Abbreviations and decimal numbers that contain a period will inflate the sentence count slightly.
Why is 160 characters the standard target for a meta description?
Most search engines truncate the meta description snippet displayed in results at around 155–160 characters. Keeping your description within 160 characters ensures the full message is shown rather than cut off with an ellipsis.
Is there a maximum input size?
There is no hard limit enforced by the tool. The textarea accepts as much text as your browser tab has available memory. For very large documents (several megabytes of text), performance remains smooth because all computation runs in a single `useMemo` call on each change.
Does the character counter store or transmit my text?
No. The character counter runs entirely in your browser. Your text is never sent to any server, logged, or retained after you close or refresh the page.