Text Width Calculator
TextEverything runs locally in your browser — nothing is uploaded
“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
- Paste the text (multiple lines are fine)
- The four numbers and the over-long-line list appear immediately
- Turn on the character breakdown for detail
- 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
Word Counter
TextCount Chinese characters and English words separately, alongside characters, lines, real UTF-8 bytes, reading and speaking time, and SMS segment counts.
Occurrence Counter
TextCount how often each character, word, line or given string appears, sorted by frequency with percentages. Spaces and breaks are labelled.
Line Length Filter
TextFilter lines by length in characters, UTF-8 bytes or display width (CJK counts as two), keeping or dropping the lines inside a range.
Text Diff
TextCompare two blocks of text online and highlight added, removed and unchanged lines, so only the lines that changed are marked. Runs in your browser.
Text Cleaner
TextClean up a column pasted out of a log or spreadsheet: deduplicate, sort, drop blank lines, trim whitespace and strip line numbers, all in your browser.
Case Converter
TextConvert identifiers between fourteen naming styles. Words are split correctly first, so acronyms such as HTTPServer come out right, all in your browser.