piapia123
en

Text Width Calculator

Text

Everything runs locally in your browser — nothing is uploaded

Input
Drop a file here to load its contents
Output

“How long is this text” has four different answers, and they often differ several-fold. This tool gives all four: display width (columns on screen, a CJK character is 2), code points (how many characters), UTF-16 units (JavaScript’s `.length`) and UTF-8 bytes (what lands in a file). A single emoji shows why: `😀` is 1 code point, 2 UTF-16 units and 4 UTF-8 bytes — so “20 character limit” only makes sense once you know which measure the form uses. Display width reuses the site’s terminal-wrapping implementation, so nothing falls out of alignment. It also lists the lines wider than 80 or 100 columns, common limits for code and commits. Everything runs in your browser; nothing is uploaded.

Features

  • All four measures at once: display width, code points, UTF-16 units, UTF-8 bytes
  • Display width by East Asian width — a CJK character is 2 columns, ASCII 1
  • Lists lines over 80 and over 100 columns, with each line’s actual width
  • Optional per-character width breakdown to see what widened a line
  • Shares the terminal-wrapping width implementation, so it cannot drift
  • Code-point based, so emoji and combining characters are not split
  • Each value copyable on its own

How to use

  1. Paste the text (multiple lines are fine)
  2. The four numbers and the over-long-line list appear immediately
  3. Turn on the character breakdown for detail
  4. Use the row copy button to take a single value

FAQ

Which measure does a “20 character limit” use?
It depends on the system: forms usually count code points, databases count UTF-16 units, and APIs or storage count bytes. All four are shown so you can match the rule you are up against.
Why does one emoji have three different lengths?
It is 1 code point (one character), occupies 2 UTF-16 units (a surrogate pair), and is 4 bytes as UTF-8. That is not a bug; the three counting methods genuinely differ.
How is display width computed?
By East Asian width: CJK characters, kana and full-width symbols count 2 columns, ASCII and half-width 1, and emoji 2. It uses the same implementation as the site’s terminal wrapping so alignment stays consistent.
Is anything uploaded?
No. It is all computed in memory in your browser, no request is made, and it works offline.

Related tools