Character Counter

Paste text in the left pane. The right pane updates as you type: code units, characters without whitespace, words split on whitespace, lines, paragraphs split by blank lines, and UTF-8 bytes. Connected Chinese usually yields a small word count—use the character column for limits; a trailing newline can add a line.

JavaScript length counts UTF-16 code units, not what readers call “letters”

This pane’s “characters” value is the string length after line endings are normalized to LF: it is the number of UTF-16 code units, the same unit that JSON.stringify and most DOM APIs use in JavaScript. Supplementary characters such as many emoji occupy two code units, so length can be 2 while the reader still sees one symbol. A true grapheme count needs Intl.Segmenter or a library. “Without spaces” removes every Unicode whitespace category character, not only the ASCII space. “Words” splits on runs of whitespace after trim—there is no Chinese or Japanese word segmentation here. “Lines” counts substrings separated by LF; “paragraphs” counts non-empty blocks separated by one or more blank lines. “Byte length” is UTF-8 from TextEncoder, what fits a byte budget on the wire or in a VARCHAR byte cap. For placeholders and layout, script choice changes line breaks—see lorem ipsum generator. For authored markup, tags and spaces both count—see Markdown to HTML. To move between decimal bytes and KiB, see byte unit converter.

What code units, graphemes, whitespace-split words, and UTF-8 bytes each measure

Why “characters” here is UTF-16 code units and can disagree with a visual character count

  1. ECMAScript exposes string length as the count of UTF-16 code units, not extended grapheme clusters.
  2. A supplementary-plane character is encoded as a surrogate pair, so length is 2 and charCodeAt shows two halves.
  3. An emoji with a skin-tone modifier or a joiner sequence can be several code units while still one extended grapheme.
  4. Normalization to NFC or NFD changes code unit count without changing what most readers see as “the same text”.

Why splitting on whitespace mis-counts “words” in Chinese, Japanese, and Thai

  1. With no spaces between words, the whole line can be one token after trim.
  2. English and French rely on spaces; CJK and Thai often do not, so “word” needs a segmenter tuned to the language.
  3. Punctuation attached to a token stays inside that token; hyphens and apostrophes are not split unless adjacent to whitespace.
  4. Multiple internal spaces collapse for counting words; they still count as separate characters unless removed in “without spaces”.

Why CRLF normalization changes line and paragraph counts from raw paste

  1. Windows ends a line with CR followed by LF; old Mac files sometimes use CR alone. Both become one LF before counting.
  2. Each LF starts a new line; an empty final line still adds one line if the string ends with a newline.
  3. A paragraph is a trimmed block between blank lines; a single newline inside a paragraph does not start a new paragraph.
  4. Markdown’s hard line break (two spaces before newline) is still one line in this counter—it does not become a paragraph break.

Why UTF-8 byte length can exceed “character” count on multilingual text

  1. ASCII is one byte per code unit; common Han characters are often three bytes in UTF-8.
  2. Emoji are often four bytes each while still contributing two UTF-16 code units in the browser string.
  3. A wire limit or SMS segment is usually counted in bytes or septets, not in JavaScript length.
  4. Database BYTE length limits align with UTF-8 octets when the column is utf8mb4, not with grapheme count.

Which column matches a limit from a product spec or a schema

A tweet, post, or bio box that says “280 characters”

The product may count extended grapheme clusters or apply a normalization first. This page counts UTF-16 code units. For emoji-heavy text, compare against the same engine the platform uses.

A database column or API field that says VARCHAR(191) bytes

Use the UTF-8 byte row. The character row is code units; trimming spaces does not shrink surrogate pairs or multi-byte Han characters.

Frequently asked questions

My character count is different from Word and Google Docs—which number should I trust?
Those tools often count “characters” as extended grapheme clusters or apply their own rules for footnotes, fields, and hidden markup. This page counts JavaScript string length in UTF-16 code units after normalizing line breaks to LF. A single emoji that uses a surrogate pair contributes 2 to that length while still looking like one symbol on screen. Word may also exclude list bullets or include field codes. To match a limit exactly, use the same counting rules the destination documents—developer tools, ICU, or the platform’s own counter—not a different editor’s notion of a character.
Why does UTF-8 byte count look about triple my character count for Chinese text?
The character count is UTF-16 code units in the JavaScript string. Common CJK unified ideographs are often encoded as one code unit in UTF-16 but take three bytes each in UTF-8. The byte row uses TextEncoder, which emits UTF-8. Emoji can be two UTF-16 code units and four UTF-8 bytes at once. A pure ASCII string keeps byte length and character count numerically close, but mixed scripts do not. For storage limits framed in UTF-8 octets, rely on the byte row, not on the character row.
How does this page count “words” for English versus Chinese or Japanese?
After trimming leading and trailing whitespace, the text is split on every run of whitespace characters. Each non-empty piece is one word. English with spaces between words behaves as expected. Chinese written without spaces between words usually becomes one token for the whole sentence or clause, so the word count is a poor proxy for “how many words” in a linguistic sense. Platforms that quote a Chinese “word” limit almost always mean characters or licensed segmentation. Use the character columns for those cases.
Why does the line count change after I paste from Notepad or Windows?
Windows line endings are carriage return plus line feed. This tool collapses CRLF and lone CR to a single LF before counting lines or paragraphs, so you do not double-count breaks. If your source ends with a newline, the line count includes an extra empty line at the end that you might not “see” when the cursor sits on the last line. Paragraphs are separated by blank lines; a soft wrap in an editor without an extra blank line is still one paragraph here.
Does Markdown syntax (#, links, code fences) count toward a character limit?
Yes. Hash marks, asterisks, brackets, and backticks are ordinary characters in the string. If the limit applies to rendered text only, strip or render first, then paste the plain output. Link destinations and image URLs count in full. Code fences include the fence characters themselves. Leading indentation spaces in a list count in the character total unless your pipeline strips them before measuring.
What is the difference between “characters” and “characters without spaces” here?
The first is the full string length after newline normalization, every symbol that JavaScript stores. The second removes all characters whose Unicode general category is treated as whitespace by the regex \s, including space, tab, newline, and many Unicode space separators. It is not a “visible only” pass: zero-width joiners and format characters remain unless they are classified as space. Narrow no-break space and ideographic space are removed; an emoji variation selector is not.
When should I use the UTF-8 byte count instead of the character count?
Use bytes when the limit names octets on the wire, column byte caps, signed payload sizes, or SMS encoding segments. HTTP and most databases count UTF-8 bytes for utf8mb4 columns. Social “character” limits are often grapheme- or normalization-based instead. If the spec says “UTF-8 length” or “bytes”, the byte row is the one that lines up. If it says “Unicode code points”, you still need a different tool—this page does not expose code point count separately.
Two copies of the same text show different counts—what usually causes that?
They may differ in normalization (NFC versus NFD combines or splits combining marks), invisible direction marks, or variation selectors on emoji. One paste may include smart quotes or non-breaking spaces while the other uses ASCII equivalents. A different editor may strip trailing newlines on save. Compare with a hex view if counts disagree; then align normalization and line-ending policy with the system that enforces the limit.