RevealTheme logo

ASCII to Hex Converter

Convert text to hexadecimal character codes and back. Each character becomes its code unit in hex — two digits for ASCII characters, more for higher code points.

How to use this tool

  1. 1

    Pick a direction from the dropdown: 'Text -> Hex' to encode, or 'Hex -> Text' to decode.

  2. 2

    Type or paste your input into the text box.

  3. 3

    Read the converted result in the output box below — it updates live as you type.

  4. 4

    For decoding, separate each hex value with a space (for example '48 65 6C 6C 6F').

What does an ASCII to hex converter actually do?

Every character maps to a number, and hexadecimal (base 16) is a compact way to write that number. The letter 'A' is 65 in decimal and 41 in hex; a space is 20. This tool reads each character's code unit with JavaScript's charCodeAt and prints it in uppercase hex, padded to a minimum of two digits and joined by spaces. For plain ASCII and Latin-1 text (code points up to U+00FF) that yields the familiar two-digit-per-character output. Note that it reports UTF-16 code units, not UTF-8 bytes: the character 'e' with an accent (U+00E9) becomes E9 here, whereas its UTF-8 byte encoding would be C3 A9. Characters above U+00FF naturally produce three or four hex digits — the euro sign becomes 20AC. The conversion is handy for debugging text-encoding problems, inspecting control characters, building escape sequences, or working with simple binary or wire protocols where you need to see the raw code behind each glyph. Decoding reverses the process: it splits your input on whitespace and turns each hex token back into its character.

Common use cases

  • Inspecting invisible control characters (tabs, newlines, non-breaking spaces) that are breaking a parser or CSV import.

  • Hand-building escape sequences like \x41 for code, regex, or shell snippets.

  • Decoding a space-separated hex dump pasted from a log, packet capture, or protocol trace back into readable text.

  • Teaching or learning how characters map to numeric codes and base-16 notation.

  • Quickly checking the hex code of a specific symbol before hard-coding it into a config or test fixture.

  • Spotting smart quotes or homoglyphs by confirming whether a character is the plain ASCII version or a higher code point.

Frequently asked questions

Is this true ASCII or Unicode?
It reads each character's UTF-16 code unit. For ASCII text (code 0-127) the values are identical to ASCII. Latin-1 accented letters also fit in two hex digits, while symbols above U+00FF (like the euro sign, 20AC) produce three or four digits.
Does it output UTF-8 bytes?
No. It reports code units, not UTF-8 bytes. The accented 'e' (U+00E9) shows as E9, but its UTF-8 encoding is C3 A9. If you need real UTF-8 byte output, use a tool built on TextEncoder().encode() instead.
Why does an emoji come out wrong?
Characters above U+FFFF (emoji, many CJK extensions) are stored as a surrogate pair in UTF-16. This naive converter reads only the first half, so a smiley becomes D83D and the round-trip fails. For astral characters use a UTF-8 byte encoder.
How should I format hex for decoding?
Separate each value with whitespace, like '48 69'. The decoder splits on spaces and converts each token, so a run-together string such as '4869' is read as one number, not two characters.
Does it validate my hex input?
Only lightly. parseInt is lenient, so a malformed token quietly produces a NaN or stray character rather than a clear error. Double-check the output if you paste untrusted or messy input.
Is the output uppercase?
Yes. Encoded hex is uppercase and space-separated (for example 'C0 FF EE'). Decoding accepts either case.
Is my text uploaded anywhere?
No. The conversion runs entirely in your browser with JavaScript. Nothing you type is sent to a server, so it is safe for sensitive strings.

Related tools