ASCII to Hex Converter
Hex is the programmer’s shorthand for bytes: two digits from 0-9 and A-F cover every value from 0 to 255 in a compact form. This converter takes ASCII text and returns the hex code for each character, which is what you need when you are writing a byte array in C, inspecting a network packet, or converting between encoding formats in a reverse-engineering session.
How ASCII becomes hex
-
1
Paste your text
Any ASCII character works — letters, numbers, punctuation.
-
2
Each character is looked up as a byte
For example, `H` is decimal 72, which is `0x48` in hex.
-
3
Hex pairs are joined
You can configure a separator: space, comma, `0x` prefix, or no delimiter at all.
-
4
Copy the result
Paste into source code, a hex editor, or a protocol analyser.
Worked example
The string Go! encodes as:
| Char | Decimal | Hex |
|---|---|---|
| G | 71 | 47 |
| o | 111 | 6F |
| ! | 33 | 21 |
So Go! becomes 47 6F 21, or \x47\x6F\x21 in C-string escape form, or 0x47, 0x6F, 0x21 as a byte array.
Output format options
| Use case | Format | Example |
|---|---|---|
| Byte array in C/C++ | 0xXX, 0xXX |
0x47, 0x6F |
| Shell echo with -e | \xXX |
\x47\x6F |
| Space-separated hex dump | XX XX |
47 6F |
| Continuous string | XXXX |
476F |
| URL percent-encoding | %XX |
%47%6F |
A common trap
Hex is case-insensitive (0x4f and 0x4F are the same byte), but many parsers care. If you are feeding the output into something strict (a YAML file, a JSON string, some assemblers), match the case convention of the surrounding code.
UTF-8 and multi-byte characters
For ASCII input every character is one byte. For UTF-8 input, characters above U+007F take 2, 3 or 4 bytes. The tool always emits one hex pair per byte, so caf\u00e9 (4 characters) produces 5 bytes of hex: 63 61 66 C3 A9.
Frequently Asked Questions
The value is not — 0x4F and 0x4f are the same byte. But some tools and code styles insist on one case. Pythons .hex()` method emits lowercase; many embedded toolchains prefer uppercase.
It is a convention from C telling the parser that the following digits are hexadecimal, not decimal. Without the prefix, 47 is either 47 (decimal) or 71 (hex) depending on context.
Probably because your source contains non-ASCII UTF-8 characters, which take multiple bytes. A 10-character string with accents can easily produce 12-14 bytes of hex.
Yes — use the Hex to ASCII Converter. It accepts continuous hex, space-separated pairs, and 0x prefixes.
Related Tools
Color Palette Generator
Generate monochromatic, analogous, complementary, triadic or tetradic color palettes from a base HEX color and export copy-ready CSS variables.
HEX Color Picker
Pick any colour visually and get its HEX, RGB, HSL, HSV and CMYK values, plus accessibility contrast against white and black.
Random Color Palette Generator
Generate random color palettes from 2 to 15 swatches, choose a vibrant, pastel, muted or dark style, then copy HEX codes or CSS variables.
BBCode to HTML Converter
Convert BBCode (bulletin-board markup) to clean HTML. Handles formatting tags, lists, quotes, code, images, links and tables.
JSON Formatter
Paste JSON to pretty-print with 2 or 4 spaces, minify it to compact output, or run a quick syntax check before copying the result.
ASCII to Binary Converter
Convert any ASCII string to its binary representation. Every character becomes eight bits, space-separated, ready to paste into a protocol trace or homework.