LocalExcelTool
Get started

Character Counter

Count characters, words, lines and bytes at once. Accurate for Japanese too.

Runs in your browserNo account neededFree

What is Character Counter

A character counter counts the characters, words and lines in a piece of text. It is useful for social media character limits and manuscript checks, and can also show the UTF-8 byte size.

🔒 Everything runs in your browser. Nothing is uploaded.

What this tool actually does with your file

Where it runs
In your browser, on this page
Upload
None — the file never leaves your device
Offline
Works with the network disconnected

Four different answers to "how long is this"

The count is reported five ways because the five disagree: characters as people perceive them, characters excluding whitespace, words, lines, and UTF-8 bytes. A 100-character Chinese sentence is about 300 bytes, so a field that allows 200 bytes accepts roughly 66 of those characters. Which number matters depends entirely on where the text is going.

Characters are counted by iterating the string as code points, not by reading .length. That matters because JavaScript's .length counts UTF-16 code units: an emoji is 2 and a flag is 4, so a tweet of 140 emoji reports 280 by .length and 140 by code points. Platforms that enforce a limit use one rule or the other, and guessing wrong is how a post gets rejected.

What counts as a word

Words are counted by splitting on whitespace, which is right for English and wrong for Chinese and Japanese — text with no spaces reports one word no matter how long it is. The interface therefore also reports the CJK character counts separately, because for those languages the character count is the meaningful measure and the word count is noise.

Hyphenated compounds count as one word, as do URLs and email addresses, which is what most editorial guidelines intend but not what every CMS does. If a hard limit is being enforced somewhere, measure with that system's rule rather than trusting a general counter.

The limits people actually hit

A meta description starts truncating around 155–160 characters in search results, a title tag around 60, an X/Twitter post at 280 (with CJK and emoji weighted differently than Latin text), an SMS segment at 160 ASCII characters or 70 for anything non-GSM. All of those are measured in different units, which is why the byte count is shown alongside the character count.

Line counting treats CRLF, CR and LF as one break each, so a file saved on Windows and one saved on Unix with the same visible content report the same number. Byte counting does not — there the line endings differ by one byte per line, and that difference is enough to break a signature or a checksum comparison.

How to use it

  1. 1.Paste your text
  2. 2.Read the results
  3. 3.Copy the numbers you need

How Character Counter works under the hood

Text tools look trivial until encoding enters the picture. The bytes are unambiguous; the characters they represent are a guess unless the encoding is declared.

  1. 1

    Read bytes, not characters

    The file is read as an ArrayBuffer so the original bytes are preserved, including a byte-order mark if present.

  2. 2

    Decode with a declared or detected encoding

    TextDecoder converts bytes to text. UTF-8 is validated; a BOM is used when present; legacy encodings must be chosen explicitly because guessing between GBK and Shift_JIS is unreliable.

  3. 3

    Transform as a pure function

    Escaping, quoting, case changes and line-ending normalisation are applied to the decoded string, so the same input always gives the same output.

  4. 4

    Encode and download

    The result is encoded back to UTF-8 (or the format's own escaping rules) and returned as a Blob.

  5. Processing pipeline

Why a file looks like mojibake

Mojibake is the same bytes decoded with the wrong table: Shift_JIS read as UTF-8, or GBK read as Latin-1. Nothing is corrupted in the file itself. If the output is garbled, the fix is to re-run with the correct source encoding, not to edit the text by hand — editing bakes the wrong characters in permanently.

CSV quoting is not optional

A CSV field containing a comma, a quote or a newline must be wrapped in double quotes, and inner quotes doubled. Tools that skip this produce files that look fine until someone imports them and the columns shift. This converter applies RFC 4180 quoting on output.

Where text tools stop

There is no reliable way to detect an unknown legacy encoding from content alone, and no way to recover bytes that were already lost. Mixed encodings inside one file cannot be fixed automatically. Very large inputs are capped because regular expressions and repeated string concatenation can take quadratic time.

Verify it yourself

Text is transformed in memory. Nothing is sent while it runs.

  1. 1.Open DevTools on this page and switch to the Network tab
  2. 2.Keep the filter on Fetch/XHR and run the tool
  3. 3.Confirm no request carries your file — you should see only page assets and fonts

Frequently asked questions

Are spaces counted?

Yes. A separate count without spaces is shown too, so you can use whichever you need.

Does it handle Japanese and emoji?

Yes. Text is counted by Unicode code points, so an emoji counts as one character.

Is my text uploaded?

No. Counting happens entirely in your browser.

What this kind of conversion cannot keep

Text tools never leave the page: the string you paste is transformed in memory and written back to the result box. There is no request, no log and no retention, which also means there is no way to recover a value you closed the tab on.

More in Text