Skip to main content
AllDevToolsHub
🔣

Hex Encoder/Decoder

100% Local

Convert between text and hexadecimal with hex dump view.

Hex Encoder/Decoder
1 lines • 16 chars
Try:
This tool runs entirely in your browser. Your input is never uploaded, logged, or sent to AllDevToolsHub or anyone else, and it keeps working offline once the page has loaded.

Paste hex string to decode, or text/binary to encode. Supports spaces, colons, and 0x prefixes.

Overview

What is Hex Encoder/Decoder?

Convert text to hex and back with configurable separators (space, colon, dash, none). Includes a classic hex dump view with offset, hex bytes, and ASCII output.
FAQ

Frequently Asked Questions

Reference

Technical Deep Dive

ENCODERS & DECODERS

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
Continuousa3f8b1Cryptographic HashesStandard
Colona3:f8:b1MAC Addresses / CertsNetworking
Prefix0xa3, 0xf8C/C++ Array LiteralsProgramming
Spaceda3 f8 b1Debugger Memory DumpsInspection

02 Hex-Dump Serialization Workflow

1
Offset Calculation The data stream is divided into 16-byte blocks, and a hexadecimal offset address is calculated for each line.
2
Nibble Decomposition Each byte is split into two 4-bit nibbles, which are then mapped to their corresponding characters (0-9, A-F).
3
ASCII Reification The original bytes are checked for printability (ASCII 32-126). Printable characters are preserved; others are replaced with dots.

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 with 50 4B 03 04. file(1), libmagic, and your own format sniffer all compare hex prefixes. Reading 52494646 tells 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

EXAMPLE 1 · IDENTIFYING A PNG BY ITS FIRST 8 BYTES
First 16 bytes of an unknown file:
89 50 4E 47 0D 0A 1A 0A 00 00 00 0D 49 48 44 52
Decoding what we see:
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.




EXAMPLE 2 · 0x PREFIX CONVENTIONS

Same 4 bytes across languages:

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:FE

Same payload, five conventions:

DE AD BE EF

Whether 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.




EXAMPLE 3 · WHY 2× OVERHEAD IS WORTH IT (SOMETIMES)

A 32-byte SHA-256 hash:

hex:    e3b0c44298fc1c149afbf4c8996fb92427ae41e4
649b934ca495991b7852b855 (64 chars)
base64: 47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU= (44 chars)

Decision:

For diffing logs by eye   → hex wins
For URL fragments / JWTs → base64 wins
For 1 MB binary uploads → neither; use raw bytes

Hex 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.

You Might Also Need