ASCII to Hex Converter
Convert ASCII text to hexadecimal and hex to ASCII instantly. Supports all characters, multiple delimiters, and bidirectional conversion online.
About
Character encoding errors corrupt data silently. A misinterpreted byte in a network packet, a wrong hex value in firmware, or a malformed escape sequence in a protocol payload - each produces failures that are difficult to trace after the fact. This converter performs bidirectional translation between ASCII text and its hexadecimal representation, operating on raw code point values via charCode = charCodeAt(i). It handles the full byte range 0x00 - 0xFF and extends to multi-byte Unicode. The tool parses hex input regardless of delimiter format: space-separated, colon-separated, comma-separated, or 0x-prefixed tokens.
Approximation note: values above 0xFF represent multi-byte Unicode code points, not strict single-byte ASCII. For protocol work (MQTT, SPI, UART debug logs), verify your target system's encoding assumption - UTF-8 multi-byte sequences differ from raw code point values. Pro tip: when pasting hex dumps from Wireshark or serial monitors, select the matching delimiter format before converting to avoid parse errors on mixed whitespace.
Formulas
The conversion from a text character to its hexadecimal representation operates on the Unicode code point of each character.
For each character at index i in the input string, charCodeAt returns the decimal code point c. This integer is then converted to base-16 notation. Single-digit results are zero-padded to maintain consistent two-character width per byte.
The reverse operation splits the hex input into valid tokens, parses each as a base-16 integer, and maps the resulting code point back to a character. Tokens are isolated by a regex pattern that handles mixed delimiters.
Where hexPair is a string of 1 - 4 hex digits (e.g., "48", "0A", "20AC"), i is the character index, and c is the decimal code point in range 0 - 65535.
Reference Data
| Char | Dec | Hex | Description |
|---|---|---|---|
| NUL | 0 | 00 | Null |
| SOH | 1 | 01 | Start of Heading |
| STX | 2 | 02 | Start of Text |
| ETX | 3 | 03 | End of Text |
| EOT | 4 | 04 | End of Transmission |
| ENQ | 5 | 05 | Enquiry |
| ACK | 6 | 06 | Acknowledge |
| BEL | 7 | 07 | Bell / Alert |
| BS | 8 | 08 | Backspace |
| HT | 9 | 09 | Horizontal Tab |
| LF | 10 | 0A | Line Feed |
| VT | 11 | 0B | Vertical Tab |
| FF | 12 | 0C | Form Feed |
| CR | 13 | 0D | Carriage Return |
| ESC | 27 | 1B | Escape |
| SP | 32 | 20 | Space |
| ! | 33 | 21 | Exclamation Mark |
| " | 34 | 22 | Double Quote |
| # | 35 | 23 | Hash / Number Sign |
| 0 | 48 | 30 | Digit Zero |
| 9 | 57 | 39 | Digit Nine |
| A | 65 | 41 | Uppercase A |
| Z | 90 | 5A | Uppercase Z |
| a | 97 | 61 | Lowercase a |
| z | 122 | 7A | Lowercase z |
| ~ | 126 | 7E | Tilde |
| DEL | 127 | 7F | Delete |
| Γ | 128 | 80 | Extended: Latin C-cedilla |
| ΓΌ | 252 | FC | Extended: Latin u-umlaut |
| 255 | FF | Extended: Non-breaking space (Latin-1) |