Text Encoding Inspector

See the bytes and code points behind any text. Type or paste text and view its UTF-8 bytes or Unicode code points in hex, decimal, octal or binary, with prefixes like 0x, \x or U+ and your choice of separator — then paste numbers to turn them back into text. It shows the character, code point and byte counts side by side, which is where most encoding bugs hide. It's free, runs in your browser, and nothing leaves your device.

One character, three counts

TextCode pointsUTF-8 bytesJS length
A1 (U+0041)1 (41)1
é1 (U+00E9)2 (c3 a9)1
€1 (U+20AC)3 (e2 82 ac)1
👋1 (U+1F44B)4 (f0 9f 91 8b)2

When to use it

  1. Debug mojibake by checking the actual bytes of a string.
  2. Get the \x escape sequence for a string in C, Python or a regex.
  3. Find the U+ code point of an emoji or symbol.
  4. Decode a hex byte dump from a log back into text.

How to Use

  1. Type or paste your text.
  2. Choose UTF-8 bytes or code points, and the base.
  3. Pick a prefix and separator.
  4. To go back, paste numbers in the Back to text box.

Features

  1. UTF-8 bytes and code points
  2. Hex, decimal, octal and binary
  3. Prefixes: 0x, \x, U+, &#x, \u
  4. Strict UTF-8 decoding
  5. Character, code point and byte counts
  6. 100% client-side

FAQs

What's the difference between bytes and code points?

A code point is the character's number in Unicode (é = U+00E9). Bytes are how UTF-8 stores it (é = c3 a9). ASCII characters are the same in both.

Why does JavaScript say an emoji has length 2?

It counts UTF-16 code units. Most emoji are one code point and four UTF-8 bytes but two UTF-16 units.

Can I convert hex back to text?

Yes. Paste hex bytes or code points with or without prefixes like 0x or \x.

What if the bytes aren't valid UTF-8?

You get an error instead of question-mark characters, so a wrong decode isn't mistaken for a right one.

Is my text uploaded?

No. Everything runs in your browser.

Technical Details

There are two different numbers people mean by 'the code' of a character, and the inspector keeps them separate. Unicode code points identify characters: é is U+00E9 and 👋 is U+1F44B. UTF-8 bytes are how those code points are stored: é takes two bytes, c3 a9, and the emoji four. JavaScript's string length counts neither — it counts UTF-16 code units, which is why it reports 2 for one emoji. The tool shows all three counts and lets you view either bytes or code points in hexadecimal, decimal, octal or binary, padded to width, with prefixes such as 0x, \x, U+ or &#x and the separator of your choice. Converting back parses numbers with any of those prefixes and separators. Bytes are decoded as strict UTF-8, so an invalid sequence is reported instead of silently turning into replacement characters; code points become characters directly.

Developer Tools

Developer Tools

  • Punycode Converter
  • Email Obfuscator
  • UUID Validator
  • ULID Generator
  • SemVer Compare
  • Bitwise Calculator
  • MIME Type Lookup
  • Luhn Validator