Hex encode and decode
Convert text to hexadecimal bytes or decode hex back to text. Runs in your browser.
Runs 100% in your browserHow to convert text and hex
- Choose a mode. Encode for text → hex, or Decode for hex → text.
- Enter your data. Paste text or hex bytes; the result appears instantly.
- Copy the result. Click Copy to grab the output.
About hexadecimal encoding
Hexadecimal represents each byte as two digits (00–FF), making binary data readable and compact. Developers reach for hex when inspecting raw bytes, debugging protocols, reading hashes, or working with color and memory values. This converter treats text as UTF-8 and accepts loosely formatted hex input so you can paste from almost anywhere.
Each byte always becomes exactly two hex digits, so a value below 16 keeps its leading zero — the byte
9 is 09, not 9. That fixed width is what makes hexdumps line up in columns and
lets tools read bytes back unambiguously. Hex is purely positional: it preserves byte order exactly as
given and adds no checksum, length prefix or framing, so it round-trips losslessly but tells you nothing
about whether the data is correct. Compared with Base64, hex is easier to read by eye and align to byte
boundaries, at the cost of size — it doubles the byte count where Base64 adds only about a third. Reach
for hex when you need to inspect bytes, and Base64 when you need to transport them
compactly.
Where you meet hex in practice
Hex turns up wherever raw bytes need a human-readable label. Cryptographic hashes such as MD5 and
SHA-256 are almost always printed as hex digests; CSS colours like #1d4ed8 are three hex
bytes of red, green and blue; MAC addresses, memory pointers in a debugger, and the "magic number" at the
start of a file (a PNG begins 89 50 4e 47) are all read in hex. URL percent-encoding is hex
too — a space is %20 because 0x20 is the byte for space. Recognising those
two-digit groups, and being able to flip them back to text, is often the quickest way to confirm what a
blob of data really contains.
UTF-8, case and the gotchas
Because this converter works on the UTF-8 byte stream, anything outside basic ASCII expands to more than
one byte: é is c3 a9, and an emoji can be four bytes. That is correct, not a
bug — decode the same hex and the original character comes back intact. It is a byte-for-byte stream, not
an integer converter, so it never reorders bytes for endianness; the sequence you give is the sequence you
get. On the way in it is case-insensitive (4F and 4f decode identically) and
ignores spaces, newlines, commas and 0x prefixes; on the way out it emits lowercase,
zero-padded pairs so hexdumps stay aligned.
Frequently asked questions
- It converts text to its hexadecimal byte representation and back. Encode turns each UTF-8 byte into a two-digit hex value; Decode reads hex bytes back into text.
- It is forgiving: spaces, newlines, commas and
0xprefixes are ignored, so48 65 6c 6c 6f,0x48,0x65and48656c6c6fall decode correctly. - Yes. Text is treated as UTF-8, so multi-byte characters encode to multiple hex bytes and decode back exactly.
- No. The conversion runs locally in your browser.