Skip to main content
NyankoTools

Byte Length Counter (UTF-8, Shift_JIS, UTF-16)

Type or paste text to see how many bytes it takes in UTF-8, Shift_JIS and UTF-16, updated live. Use it to check database column sizes, API string limits or SMS length limits. Enter a byte limit and the tool shows exactly which character pushes the text over it. For character and word counts, use the Character Counter; to convert between encodings, use the Character Encoding Converter. Your text is processed in the browser and never sent to a server.

🔒 Runs in your browser · Your data is never sent to a server

UTF-8
0bytes
Shift_JIS
0bytes
UTF-16
0bytes
Characters
0

Counting options

Byte limit check

Choose an encoding and a byte limit to see the part that fits and the point where the text goes over.

Bytes used
0
Remaining
255

The text fits within the limit.

Notes

  • UTF-8 uses 1 to 4 bytes per character (1 for ASCII, 3 for hiragana and kanji, 4 for emoji); UTF-16 uses 2 or 4. You can choose whether a BOM is included.
  • Shift_JIS counts half-width letters, digits and half-width katakana as 1 byte and full-width characters as 2. Characters Shift_JIS cannot represent (emoji, some symbols and rare kanji) are counted as a replacement "?" (1 byte), as an actual conversion would do, and listed below the counts.
  • Shift_JIS is counted with a table close to Windows CP932 (the Microsoft extension). Some databases and systems convert differently, so the byte count can differ.
  • UTF-16 is counted without a BOM by default, as 2 bytes, or 4 bytes for a surrogate pair. Little-endian and big-endian give the same length.
  • Characters are counted as Unicode code points, not visible glyphs, so emoji built from several code points count as multiple characters.
  • The text box uses LF for line breaks. If your file or API uses CRLF, choose "Normalize to CRLF" so each line break counts as 2 bytes.
  • Some systems, such as MySQL VARCHAR(n), limit characters rather than bytes. Check whether your limit is in bytes or characters.

FAQ

How many bytes is a Japanese character?

In UTF-8, hiragana, katakana, kanji and full-width symbols take 3 bytes, ASCII takes 1 and emoji take 4. In Shift_JIS, full-width characters take 2 bytes and ASCII and half-width katakana take 1. In UTF-16, most characters take 2 bytes and emoji take 4.

How are characters that Shift_JIS cannot represent counted?

Characters missing from Shift_JIS, such as emoji, become "?" (or cause an error) when actually converted. This tool counts each one as a 1-byte "?" and lists the affected characters so you can replace them or switch to UTF-8.

What if my database limits characters, like VARCHAR(255)?

MySQL VARCHAR(n) and PostgreSQL varchar(n) limit characters, not bytes, so byte length does not matter there. Byte-based limits apply to things like Oracle byte-semantics columns and MySQL index key length. Check which one your system uses, and use this tool when the limit is in bytes.

How do I find where the limit is exceeded?

In the byte limit check, pick an encoding and a limit. The text is split into the part that fits and the part that goes over, and the character number where it goes over is shown. Multi-byte characters are never cut in half; if a character does not fit, the fitting part ends just before it.

Is my text saved or sent anywhere?

No. Byte counting happens entirely in your browser, and your text is never sent to or stored on a server.

Share this page

↑↓ Select Enter Open Esc Close