Hex ↔ ASCII Converter

Convert text to hexadecimal or hex back to ASCII. Supports space-separated and 0x prefix output. 100% client-side.

Last reviewed: April 2026

New to this tool? Click here for instructions

Input
Output
Paste text or hex values above to convert.

Translate between raw bytes and human-readable text instantly. Paste ASCII to see the underlying hex, paste hex to decode it back, and inspect a classic hex-dump-style visualization of any input — all client-side, with no uploads.

What This Tool Does

This converter is a bidirectional bridge between two representations of the same data. Paste ASCII text and the tool emits the hex byte sequence — every character becomes its two-digit hex code, optionally separated by spaces or prefixed with 0x. Paste a hex string (with or without spaces, commas, or 0x prefixes) and the tool reassembles the original ASCII text by parsing each pair of hex digits as one byte and rendering the corresponding character. The same input field handles both directions; mode chips at the top of the tool select which conversion runs.

The tool also renders a classic hex-dump visualization for any input — three vertical columns showing byte offset, hex byte values, and printable ASCII translation, exactly as you would see them in xxd, hexdump -C, or HxD. This is the format every reverse engineer, protocol analyst, and forensic investigator learns to read fluently. The entire conversion runs in your browser via vanilla JavaScript — no input ever leaves your machine, no analytics on the converted content, and the tool works offline once the page is loaded.

How to Use It

The interface follows a predictable left-input, right-output layout shared across every encoder/decoder in this tool family. Working from top to bottom takes about ten seconds for a typical conversion.

Select Conversion Direction

Click ASCII → Hex or Hex → ASCII on the mode chips row. The direction chip you select determines how the tool interprets your input. The default is ASCII → Hex; switching reloads the example with appropriate sample data for that direction.

Pick Output Formatting

For ASCII → Hex conversions, two independent format toggles control the output style. Space-separated inserts a single space between each byte pair (e.g., 48 65 6C 6C 6F instead of 48656C6C6F) — easier to read by eye, easier to copy into documentation. 0x Prefix emits each byte as 0xNN, suitable for pasting directly into C, Python, JavaScript, or Rust source code. Enabling 0x automatically enables spacing, since 0x-prefixed runs are unreadable without separation.

Paste or Type Your Input

Drop ASCII text or hex bytes into the input pane on the left. Conversion runs live with a 150 ms debounce as you type — there is no separate Convert button to press. The status bar below the panes turns green when conversion succeeds and red on parse errors, with the specific error message inline (most commonly: odd number of hex digits, or non-hex characters mixed in).

Copy or Download the Result

The output pane on the right populates automatically. Copy sends the converted text to your clipboard; Download saves it as output.txt. The Clear button wipes the input and resets the status bar; Try Example pre-loads a sample value (Hello, World! for ASCII → Hex, or its 13-byte hex equivalent for the reverse direction). Tab in the input pane inserts two spaces instead of leaving the textarea, which matters when you are pasting partial hex dumps and want to preserve indentation.

Worked Example: "Hello, World!" Round Trip Plus a Magic Number

Input (ASCII)
Hello, World!
Expected hex (space-separated)
48 65 6C 6C 6F 2C 20 57 6F 72 6C 64 21
Byte count
13 bytes
  1. Enter the source string. Select ASCII → Hex, enable Space-separated, then type Hello, World! into the input pane. The output pane fills with the hex sequence above as you type.
  2. Verify the first byte. The ASCII letter H has codepoint 72 in decimal. Convert to hex: 72 = 4 × 16 + 8 = 48. Match the first byte in the output: 48. The second byte, 65, is decimal 101 — the letter e. Continuing this byte-by-byte mapping reproduces the entire output column.
  3. Check the count. The status bar reads Done — 13 characters, 13 bytes. Each character is a single ASCII byte; no multi-byte UTF-8 sequences are present in this input.
  4. Reverse the direction. Switch to Hex → ASCII. The Try Example button now pre-loads 48 65 6C 6C 6F 2C 20 57 6F 72 6C 64 21. The output pane shows Hello, World! — confirming a clean round trip with no loss.
  5. Decode a magic number. Clear the input. Paste 4D 5A into the Hex → ASCII pane. The output reads MZ — the two-byte signature at offset 0 of every Windows PE/EXE binary, named after Mark Zbikowski, the DOS designer who chose his own initials as the magic number in 1981.

Expected output for the round trip: hex output 48 65 6C 6C 6F 2C 20 57 6F 72 6C 64 21; reverse decode returns the original string exactly. For the magic-number test: input 4D 5A decodes to MZ.

Hex dump of "Hello, World!" showing offset, hex bytes, and ASCII columns OFFSET HEX BYTES ASCII 00000000 48 65 6C 6C 6F 2C 20 57 Hello, W 00000008 6F 72 6C 64 21 orld! PE/EXE magic number example: 00000000 4D 5A 90 00 03 00 00 00 MZ ...... Each row: 8-digit hex offset · 16 hex bytes (8 shown) · printable-ASCII column with `.` for non-printable bytes. The MZ signature identifies every Windows executable, named after DOS designer Mark Zbikowski.
Classic hex dump layout: offset column on the left, hex byte values in the middle, printable ASCII translation on the right. Non-printable bytes appear as dots in the ASCII column — a convention shared by xxd, hexdump -C, and HxD.

Common Use Cases: Reverse Engineering, Forensics, and Protocol Work

File Format Reverse Engineering

Every binary file format has structure: a header with magic numbers, length-prefixed sections, optional metadata, and a payload. When the format is undocumented or partially documented, the first move is always to open the file in a hex editor and look for visual patterns — repeated four-byte length fields, ASCII-readable identifiers (FourCC tags in RIFF/AVI/WAV files, atom names in MP4), and offset chains that point from one section to another. A hex-to-ASCII converter lets you decode individual byte spans on demand without firing up a full hex editor for one-off questions.

Network Packet Analysis

Wireshark and tcpdump both default to displaying captured packets as hex bytes with an ASCII sidebar. When debugging a custom protocol, you'll spend hours staring at hex dumps trying to match the bytes you see against your protocol specification. Pasting a hex run into this tool gives you the ASCII interpretation in one click — invaluable when the payload includes string fields like HTTP headers, JSON bodies, or user-agent strings buried inside framed binary protocols.

Debug Crash Dumps and Memory Inspection

Windows minidumps, Linux core files, and runtime debugger output all surface raw memory as hex. When a crash report includes a stack trace with addresses and a memory dump, decoding string buffers and stack-allocated structs by eye depends on quick hex↔ASCII conversion. The Binary ↔ Text Converter handles the same conversion at the bit level for embedded debug logs that print binary; the Base64 Encoder/Decoder covers the other common binary-in-text format.

Firmware Blob Decoding and Binary Protocols

Router firmware, BIOS dumps, microcontroller flash images, and IoT device firmware all arrive as raw binary blobs. Even before disassembly, scanning the hex dump for ASCII strings reveals firmware versions, hardcoded URLs, debug messages, and credential constants — the classic strings Unix tool exists for exactly this reason. For binary protocols (Modbus, CAN bus, custom serial frames), each field of each frame is a hex byte you'll convert dozens of times while writing a parser.

Edge Cases and Limitations

A handful of byte-level behaviors and Unicode subtleties trip up new users — knowing them in advance saves debugging time.

UTF-8 multi-byte sequences expand the byte count. ASCII characters take 1 byte each; Latin-1 supplement (accented Western European letters), Greek, Cyrillic, and Hebrew take 2 bytes each in UTF-8; most CJK ideographs and the Basic Multilingual Plane take 3 bytes; emoji and supplementary-plane codepoints take 4 bytes. The string café looks like four characters but encodes as 63 61 66 C3 A9 — five bytes — because é is a 2-byte UTF-8 sequence. The status bar shows both character count and byte count separately to make this visible.

Non-printable bytes appear as dots in dump ASCII columns. Bytes 0x00 through 0x1F (control characters), 0x7F (DEL), and bytes above 0x7F that are not part of a valid printable encoding are conventionally rendered as . in the ASCII column of a hex dump. The raw byte value is preserved — only the visual rendering substitutes a dot. This convention dates to od, the original Unix octal dump utility from 1971, and survives unchanged in xxd, hexdump -C, HxD, and every other hex viewer.

Endianness matters for multi-byte integers. A 32-bit integer with value 0x12345678 is stored as 12 34 56 78 in big-endian memory (network byte order, ARM by default, PowerPC) but as 78 56 34 12 in little-endian memory (x86, x86-64, ARM in little-endian mode, RISC-V). When you decode a hex dump from a binary file, you have to know the endianness to interpret multi-byte integer fields correctly. ASCII strings are unaffected — they read the same in either byte order.

BOM detection identifies text-file encoding. A byte-order mark (BOM) at the start of a text file signals its encoding: EF BB BF is the UTF-8 BOM, FF FE is UTF-16 little-endian, FE FF is UTF-16 big-endian, FF FE 00 00 is UTF-32 LE, and 00 00 FE FF is UTF-32 BE. The UTF-8 BOM is optional and increasingly omitted on Linux; on Windows, Notepad emits it by default.

File magic numbers are diagnostic. A hex dump's first row often tells you the entire file format. 4D 5A = Windows PE/EXE; 89 50 4E 47 0D 0A 1A 0A = PNG; 25 50 44 46 = PDF (%PDF); 50 4B 03 04 = ZIP (including DOCX, XLSX, JAR, APK); 7F 45 4C 46 = Linux ELF; CA FE BA BE = Java class file; FF D8 FF = JPEG. The file(1) utility on Unix and Wireshark's protocol dissectors both rely on these signatures.

Behind the Scenes: xxd, hexdump, od, and the Hex Editor Tradition

Why Hex Is the Standard Binary Representation

Hex prevailed over alternatives for a reason that's almost purely mathematical: base 16 maps cleanly to 8-bit bytes. Four bits encode 2^4 = 16 distinct values, and 8 bits encode 2^8 = 256, which is exactly two hex digits. Every possible byte value from 0x00 to 0xFF has a fixed-width, unambiguous two-character hex representation — no padding, no variable-width strings, no leading-zero conventions. Octal (base 8) uses 3 bits per digit, which doesn't divide evenly into 8 — encoding a single byte takes 3 octal digits and wastes a bit. Decimal requires 1 to 3 digits per byte (values 0–255), forcing every reader to mentally pad. Hex avoids both problems.

The Three Classic Unix Hex Dump Tools

Three command-line utilities have dominated Unix hex dumping for decades, each with slightly different defaults. od (octal dump, 1971) is the oldest; despite the name it supports hex output via -tx1 -An. hexdump (BSD, 1990s) is more configurable via printf-style format strings; the -C flag produces canonical output with offset, hex bytes, and ASCII column. xxd (shipped with vim) added a critical capability the others lack: a reverse mode (-r) that converts a hex dump back into the original binary, which makes xxd the go-to tool for binary editing pipelines (edit the dump in vim, run xxd -r to rebuild the file).

The Venerable Hex Editor Tradition

Graphical hex editors trace back to the early PC era. HxD (Windows, free) is the default starting point for Windows reverse engineering, with built-in disk and RAM editing. 010 Editor (cross-platform, commercial) introduced binary templates — small scripts that parse a file format and overlay typed structure on top of the raw hex view, transforming an opaque blob into navigable named fields. Hex Fiend dominates on macOS for its speed on multi-gigabyte files. Ghidra (NSA, open-source) bundles a hex view inside a full reverse-engineering suite alongside disassembly and decompilation. The hex editor as a category is older than the windowed operating system; it remains the lowest level of practical file inspection short of writing your own parser.

Comparison: This Tool vs. xxd, hexdump, od, and Hex Fiend

The browser-based tool here covers the encode/decode core but is deliberately not a full hex editor. The table below maps it against the four most common alternatives so you know when to pick which.

Hex Tools Compared: Capabilities, Strengths, and Trade-offs
Tool Platform Strength Reverse Mode Binary Editing Typical Use
This tool (browser) Any browser Instant, no install, paste-friendly, offline-capable Yes (Hex → ASCII mode) No One-off byte conversions, magic-number lookup, quick string decode
xxd file Unix (ships with vim) Canonical 16-byte rows; -r reverses dump back to binary Yes (xxd -r) Via edit-dump-rebuild pipeline Scripted hex pipelines; binary patching workflows
hexdump -C file Unix (BSD-derived) Configurable via printf-style format strings; canonical output mirrors xxd No No Quick inspection; protocol-trace formatting; custom column layouts
od -An -tx1 file POSIX (everywhere) Oldest, most portable; available even on minimal Unix installs No No Maximum portability; embedded Linux; busybox environments
Hex Fiend macOS (free) Multi-gigabyte file handling; fast scrolling; built-in diff N/A (GUI editor) Yes — full editor Inspecting large binaries; macOS reverse engineering
HxD / 010 Editor Windows / cross-platform HxD: free, disk/RAM editing. 010: binary templates parse formats N/A (GUI editor) Yes — full editor Windows reverse engineering; structured binary parsing
The browser tool covers conversion fast; CLI tools win for scripting and pipelines; GUI hex editors win for editing large files or applying parsing templates. Pick the lightest tool that covers your actual task.

Frequently Asked Questions

Hex strikes the practical balance between compactness and human readability for raw bytes. Each byte (8 bits) maps cleanly to exactly two hex digits, so a 256-byte block prints in 512 characters with no padding or framing ambiguity. Binary representation would consume four times the space (8 bits per byte) and induce reader fatigue almost immediately; decimal representation breaks the byte boundary because values 100-255 occupy three digits while 0-99 occupy one or two. Hex preserves a fixed two-character width per byte, which is why every hex editor, debugger, and protocol dump tool defaults to it.
A magic number is a short sequence of bytes — typically the first 2 to 8 bytes — at the start of a file that identifies its format independently of the file extension. Examples include 4D 5A ("MZ") for Windows PE/EXE executables, 89 50 4E 47 0D 0A 1A 0A for PNG images, 25 50 44 46 ("%PDF") for PDF documents, 50 4B 03 04 for ZIP archives (including DOCX, XLSX, JAR), and 7F 45 4C 46 ("ELF") for Linux ELF binaries. The Unix file(1) utility and libmagic database use these signatures to classify content; antivirus and forensic tools rely on them when extensions have been spoofed.
A standard hex dump line has three columns: a left-aligned offset showing the byte address (hex), a middle block of hex byte values usually formatted as 16 bytes per row, and a right-aligned ASCII column rendering each byte as its printable character (with non-printable bytes shown as a dot). Read left-to-right, top-to-bottom: the offset increments by 16 (0x10) per row, the hex column lets you inspect individual byte values, and the ASCII column lets you spot embedded strings, magic numbers, and structural patterns at a glance. A trained eye can identify file types and locate metadata blocks from the ASCII column alone.
Both produce hex dumps but with subtly different defaults. xxd (ships with vim) outputs offset, 16 hex bytes grouped in 2-byte words, then an ASCII column — and critically, supports a -r reverse mode that converts a hex dump back into the original binary, making it ideal for binary editing workflows. hexdump (BSD-derived) is more configurable via format strings; its -C flag ("canonical") produces output similar to xxd. od (octal dump) is the oldest of the three and defaults to octal output, but with -tx1 -An flags it produces hex byte streams suitable for piping. For most modern reverse-engineering work, xxd is the default choice.
UTF-8 encodes each Unicode codepoint as 1 to 4 bytes. ASCII characters (U+0000 to U+007F) take one byte each and look identical to ASCII in hex. Codepoints U+0080 through U+07FF take two bytes; U+0800 through U+FFFF take three bytes; supplementary plane codepoints (emoji, rare CJK) take four bytes. Multi-byte sequences begin with a lead byte whose high bits indicate the sequence length (110xxxxx, 1110xxxx, 11110xxx), followed by continuation bytes starting with 10xxxxxx. The euro sign (U+20AC) appears as E2 82 AC; the snowman (U+2603) as E2 98 83; the smiling-face-with-tears emoji (U+1F602) as F0 9F 98 82.
Yes — that's the entire purpose of hex editors. Tools like HxD (Windows), 010 Editor (cross-platform, with binary templates), Hex Fiend (macOS), wxHexEditor (Linux), and Ghidra's built-in hex view let you locate a byte offset, overwrite it with a new value, and save the modified file. This is how ROM hackers patch game logic, how reverse engineers neutralize anti-debugging checks, and how forensic analysts repair corrupted file headers. Caveat: many file formats include checksums or signatures that fail after raw edits, so binary patches often require updating a CRC, recalculating a hash, or re-signing the executable.
A binary signature is a recognizable byte pattern that uniquely identifies a piece of code, a file format, or a malware family. File-format signatures (magic numbers) sit at fixed offsets — usually offset 0 — and identify the format. Antivirus signatures are byte sequences extracted from known malicious code; they may appear anywhere in the file and are matched via fast string-search algorithms (Aho-Corasick, Boyer-Moore). YARA rules generalize this concept by combining hex patterns with logical conditions. Binary signatures are also embedded in cryptographically signed executables (Authenticode on Windows, Mach-O code signatures on macOS) to verify integrity and publisher identity.
A byte holds 8 bits, and a single hex digit represents 4 bits (because 2^4 = 16). Two hex digits therefore encode exactly one byte with no leftover bits and no wasted capacity — every possible byte value from 0x00 to 0xFF maps to a unique two-character string. That clean mapping is why hex became the universal shorthand for byte-level data in computing. Octal (3 bits per digit) doesn't divide evenly into 8, and decimal (a non-power-of-two base) requires variable-width strings to represent the full byte range. The mathematical neatness of base 16 against an 8-bit byte is the reason hex won out historically.