Hex Encoder/Decoder
100% LocalConvert between text and hexadecimal with hex dump view.
Paste hex string to decode, or text/binary to encode. Supports spaces, colons, and 0x prefixes.
What is Hex Encoder/Decoder?
Frequently Asked Questions
Technical Deep Dive
Hex Encoder/Decoder
Convert text to hex and back with configurable separators (space, colon, dash, none). Includes a classic hex dump view showing offset, hex bytes, and ASCII representation side by side.
Spec-Compliant
Follows the RFC or de-facto encoding rules, no custom dialects, no surprises.
Lossless Round-Trip
Encode then decode and you get back exactly what you put in, byte for byte.
Handles Edge Cases
Unicode, padding, invalid input, surfaced clearly instead of silently mangling output.
01 Hexadecimal Format Matrix
| Format Name | Example | Common Use Case | Dialect |
|---|---|---|---|
| Continuous | a3f8b1 | Cryptographic Hashes | Standard |
| Colon | a3:f8:b1 | MAC Addresses / Certs | Networking |
| Prefix | 0xa3, 0xf8 | C/C++ Array Literals | Programming |
| Spaced | a3 f8 b1 | Debugger Memory Dumps | Inspection |
02 Hex-Dump Serialization Workflow
03 When You Reach for Hex
Hex is the encoding you want when each byte matters individually, for inspection, comparison, or transcription. It is the wrong tool when bandwidth and storage cost dominate.
-
File-format magic numbers A PNG starts with the eight bytes
89 50 4E 47 0D 0A 1A 0A. A ZIP starts with50 4B 03 04.file(1), libmagic, and your own format sniffer all compare hex prefixes. Reading52494646tells you "RIFF" without an ASCII decoder in the way. -
Network packet dumps Wireshark,
tcpdump -xx, and every protocol RFC display payloads in hex. Parsing a TLS ClientHello or decoding a malformed DNS response means staring at hex side-by-side with the field offsets, Base64 would erase the byte boundaries. -
Cryptographic hash and key output
openssl dgst -sha256,shasum, and Git all emit hex. A SHA-256 is 64 hex chars; comparing two artifacts by eye is easy because each byte aligns. MAC addresses and certificate fingerprints follow the same convention. -
Firmware blobs and embedded contexts Hex dumps of an EEPROM image are readable and diffable, which is why Intel HEX and Motorola S-record formats exist. Just remember every byte costs two characters, a 1MB image is 2MB on disk, double Base64's overhead.
-
Storing large binaries over the wire Hex is 2x the input size; Base64 is 1.33x. For an API moving anything bigger than a hash, the hex overhead is wasteful, pick Base64 (or, better, a raw binary upload) instead.
04 Worked Examples
89 50 4E 47 0D 0A 1A 0A 00 00 00 0D 49 48 44 52
89 50 4E 47 → PNG signature byte + "PNG"
0D 0A 1A 0A → CRLF, EOF, LF (line-ending probe)
00 00 00 0D → next chunk length = 13
49 48 44 52 → "IHDR" chunk type
PNG embeds a deliberate line-ending probe in its header to detect transfers that corrupted CRLF→LF or stripped the high bit. Reading hex makes this immediately visible; Base64 would smear the structure across character boundaries.
C: uint8_t buf[] = { 0xDE, 0xAD, 0xBE, 0xEF };
Python: b"Þ¾ï"
JSON: "deadbeef" (no prefix)
SQL: X'DEADBEEF' (or 0xDEADBEEF in T-SQL)
MAC addr: DE:AD:BE:EF:CA:FEDE AD BE EFWhether 0x belongs depends on the host language. Strip it before decoding; restore it when emitting for a C-style consumer. Our decoder accepts all five forms above without configuration.
hex: e3b0c44298fc1c149afbf4c8996fb92427ae41e4
649b934ca495991b7852b855 (64 chars)
base64: 47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU= (44 chars)For diffing logs by eye → hex wins
For URL fragments / JWTs → base64 wins
For 1 MB binary uploads → neither; use raw bytesHex is 50% denser than Base64 on the page but a third less efficient on the wire. For 32-byte digests the size delta is negligible; for kilobyte blobs it adds up fast. Pick on use-case, not habit.
05 Related Tools
Hex is usually one stop on the way to identifying a file, verifying a hash, or reading a network capture.
Hash Generator
SHA-256, MD5, and friends emit hex by default, compare directly with the output of shasum or openssl dgst.
Base64 Encoder
When 2× size overhead is too much, the denser alternative for transmitting the same bytes.
Color Converter
CSS colors are 3- or 6-digit hex literals, same encoding, different domain.