Count UTF-8 bytes, UTF-16 code units, Unicode code points and characters in any string, right in your browser
- Runs locally
- Category Developer & DevOps
- Best for Formatting, validating, shrinking, or inspecting code-adjacent text.
What this tool does
A free byte counter that tells you exactly how many bytes a string takes once it is encoded. Paste any text and read five numbers at once: UTF-8 bytes (what a file, a socket or a database stores), UTF-16 code units (JavaScript .length and the unit most languages call a "char"), Unicode code points (real characters including astral ones), grapheme characters (what a human counts), and line count. The byte total uses the browser's own TextEncoder, so multibyte text is exact: a Chinese character is 3 UTF-8 bytes, a plain emoji is 4. This is the tool to reach for when you are sizing a VARCHAR column, fitting a label into a fixed buffer, checking an SMS segment, or trimming text to a network packet limit. It runs fully in your browser with nothing uploaded, and the input round-trips through the URL so you can share a link that reopens the same text. One click copies every count.
Tool details
- Input
- Text
- The page exposes text boxes, numeric controls, file pickers, or structured inputs depending on the tool.
- Output
- Live result + Copy
- The result area focuses on usable output, with copy, download, or preview actions when supported.
- Privacy
- Browser-side processing
- The main tool logic does not call an external API, so inputs normally stay in the current tab.
- Save / share
- Shareable URL state
- Key settings are encoded in the URL so another person can reopen the same setup.
- Performance budget
- Initial JS <= 9 KB
- No WASM budget is declared, keeping the tool quick to open on mobile.
- Best fit
- Developer & DevOps · Developer
- Category and role tags drive related tools, internal links, and quick fit checks.
How to use
-
1. Input
Paste or drop your content into the tool panel.
-
2. Process
Click the button. All processing is local in your browser.
-
3. Copy / Download
Copy the result or download to disk in one click.
How UTF-8 Byte Counter fits into your work
Use it in the small gaps between coding, reviewing, debugging, and shipping.
Developer jobs
- Formatting, validating, shrinking, or inspecting code-adjacent text.
- Preparing snippets for documentation, tickets, commits, or handoff.
- Checking a small payload quickly without switching tools.
Developer checks
- Run irreversible transforms like minify or obfuscate on a copy.
- Keep secrets out of pasted snippets unless the tool explicitly stays local.
- Use your normal tests or linter before shipping transformed code.
Good next steps
These links move the current task into a more complete workflow.
- 1 JSON Formatter & Validator Format, validate, and minify JSON instantly — right in your browser. Open
- 2 Regex Tester Test JavaScript regex live — match highlighting, group capture, replace preview, flag toggles — browser-only Open
- 3 Word Counter Count words, characters, sentences, paragraphs and reading time in any text — instant, browser-only Open
Real-world use cases
Size a database column before it overflows
You are adding a display-name field and the column is VARCHAR with a byte limit. Paste a few worst-case names with accents and CJK, read the UTF-8 byte count, and pick a column width that will not reject real users at insert time.
Fit text into a fixed network or protocol buffer
A binary protocol gives you a fixed number of bytes for a string field. Paste your candidate value and check the UTF-8 byte total against the cap, so you trim by bytes rather than guessing by character count and corrupting a multibyte sequence at the boundary.
Check SMS and message length limits
An SMS segment and many chat APIs are limited by encoded size, not by visible characters. Drop your message in, watch the byte and code point counts, and know in advance whether it splits into a second billed segment once an emoji or two pushes it over.
Debug why .length disagrees with your backend
Your frontend says a string is 8 long but the API rejects it as too big. Paste it here and compare UTF-16 length, code point count and UTF-8 bytes; the gap usually exposes a surrogate pair or a stack of multibyte characters that the byte-based backend counts differently.
Common pitfalls
Validating length with .length and assuming it equals characters. For an emoji or any astral character .length counts 2 per character, so a 140-unit limit rejects text a user thinks is well under 140 characters.
Sizing storage by character count instead of bytes. Ten Chinese characters look like 10 but take 30 UTF-8 bytes, so a 16-byte buffer that fits 16 Latin letters overflows on the third Chinese character.
Treating one emoji as one code point. Many emoji are sequences joined by zero-width joiners or modifiers, so a single glyph on screen can be several code points and a dozen or more bytes.
Privacy
Every count runs as plain JavaScript inside your browser tab using the built-in TextEncoder. Your text is never uploaded and nothing is logged. The one thing to note: the input is encoded into the page URL so a share link reopens the same text, which means a link you paste into chat carries that text in the query string and lands in the recipient server's access log. For anything sensitive, copy the counts instead of sharing the URL.
FAQ
Tool combos
Folks in your role tend to reach for these alongside this tool.
- 555 Timer Calculator Astable f = 1.44/((R1+2R2)C) + monostable t = 1.1RC — pick R1, R2, C in Ω/kΩ and µF/nF, read frequency, duty cycle and pulse width — browser-only
- Add Line Numbers Number every line of pasted text — set start, step and separator, zero-pad to align, skip blanks, or strip numbers back off — browser-only
- AES Text Encryptor Encrypt & decrypt text with a password — AES-256-GCM + PBKDF2 via WebCrypto — 100% in your browser, nothing uploaded
- Affine Cipher Encoder & Decoder Encrypt and decrypt the ax+b affine cipher with live modular-inverse check, browser-only