Text to Hex and Hex to Text
See the exact bytes behind a piece of text, or turn a hex dump back into something readable.
Hex examples
| Text | Encoded |
|---|---|
| Hi | 48 69 Spaced: H is 48, i is 69 |
| Hello | 48656c6c6f Plain: No separators between bytes |
| Hello | \x48\x65\x6c\x6c\x6f \x: As a C, Python or shell string |
| é | c3 a9 Spaced: One character, two UTF-8 bytes |
| € | e2 82 ac Spaced: Three bytes |
| 😀 | f0 9f 98 80 Spaced: Four bytes |
Encoding guides
How each one works, with worked examples.
Everything happens in your browser. What you type or paste is never uploaded, stored or added to the share link, so it is safe to use with tokens, keys and customer data.
How text becomes hex
Computers store text as bytes, and hexadecimal is the usual way to write a byte down: two digits from 0 to 9 and a to f, covering 00 to ff (0 to 255). Plain English letters, digits and punctuation are one byte each and follow the ASCII table: A is 41, a is 61, 0 is 30 and a space is 20.
Everything else takes more than one byte in UTF-8, which is the encoding used here: accented Latin letters take two, most other scripts and symbols such as € take three, and emoji take four. That makes hex the quickest way to find an invisible problem in a string, such as a non-breaking space (c2 a0) where a space (20) should be, a zero-width space (e2 80 8b), or a byte order mark (ef bb bf) at the start of a file.
Notations it reads
When decoding, separators and prefixes are ignored, so you can paste hex as it appears in most tools without cleaning it up first.
- Spaced pairs: 48 65 6c 6c 6f
- A continuous string: 48656c6c6f
- 0x prefixes and commas, as in source code: 0x48, 0x65, 0x6c
- Escape sequences: \x48\x65\x6c
- Colons or dashes, as in fingerprints: 48:65:6c
Frequently asked questions
- Why is one character more than one hex byte?
- Only the 128 ASCII characters fit in a single byte in UTF-8. Accented letters use two bytes, most other characters three, and emoji four.
- Why does decoding say the bytes are not valid text?
- The hex is well formed but the bytes do not make UTF-8 text. It is probably binary data such as a hash, a key or part of a file, or text in another encoding such as UTF-16 or Latin-1.
- Is uppercase or lowercase hex correct?
- Both mean the same thing, and both are accepted when decoding. Lowercase is more common in programming and is what this tool writes.
More bits and bobs
- JWT DecoderDecode a JSON Web Token to read its header, claims and expiry in plain English, and check an HMAC signature, without the token leaving your browser.
- Cron Expression BuilderBuild or decode a crontab schedule field by field, read it in plain English and see the next five runs in any time zone.
- Regex TesterTest a JavaScript regular expression on your own text with live highlighting, groups, replace, a plain-English explanation and code for six languages.
- UK Salary CalculatorTake-home pay after income tax, National Insurance, pension and student loans, with Scottish rates, tax codes, bonuses and overtime.