Base16 (Hex) Encoder/Decoder

Encode raw bytes as RFC 4648 uppercase hex pairs

Free Base16 encoder and decoder following RFC 4648 — turn text into uppercase hexadecimal byte pairs and back again. UTF-8 aware, with validation for odd lengths and bad characters, all in your browser. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

What is Base16 per RFC 4648?

Base16 is the standard hexadecimal encoding defined in RFC 4648. Each byte is represented by exactly two characters drawn from 0–9 and A–F, using uppercase letters in the canonical form.

Base16, better known as hexadecimal, is the encoding that represents every byte as two characters from 0–9 and A–F. It is defined in RFC 4648 alongside Base32 and Base64, and it shows up everywhere developers inspect raw data: hashes, byte dumps, color codes, and wire formats. This tool encodes text to uppercase hex and decodes hex back to text, with full UTF-8 handling and clear validation.

How it works

To encode, the tool runs your text through a UTF-8 encoder to get the underlying bytes, then prints each byte as a zero-padded, two-digit uppercase hex value. A byte with value 71 becomes 47, the hex for the letter G.

To decode, it strips whitespace, checks that only hex digits remain, and requires an even number of them — because each byte is exactly two digits. Pairs are parsed back into bytes and run through a strict UTF-8 decoder. If the bytes are not valid UTF-8, or the input has illegal characters or an odd length, you get a precise error rather than a silent wrong answer.

Example

Encoding Gera Tools produces 47657261 20546F6F6C73 (shown without the space): G=47, e=65, r=72, a=61, space=20, and so on. Decoding 47 65 72 61 returns Gera.

When to use Base16 versus other encodings

Base16 is the most human-readable binary-to-text encoding because every pair of characters corresponds to exactly one byte, and the relationship is easy to verify mentally. That legibility comes at a cost: it is also the least space-efficient, doubling the data size.

EncodingOutput size vs inputAlphabetTypical use
Base16 (hex)0–9, A–FHashes, byte dumps, hex editors
Base32~1.6×A–Z, 2–7TOTP secrets, DNS records
Base64~1.33×A–Z, a–z, 0–9, +/Email attachments, data URIs
Base85~1.25×Printable ASCIIPDF streams, compact payloads

Choose Base16 when you need byte-level clarity — for example inspecting a cryptographic hash byte by byte, checking the magic number at the start of a file, or generating colour hex codes. Choose Base64 when compactness matters more than per-byte readability and the result goes into JSON, HTML, or email.

Multi-byte character note

ASCII characters each use one byte and produce two hex digits. Characters outside ASCII — accented letters, non-Latin scripts, emoji — are encoded as UTF-8, which uses 2–4 bytes per character. The letter é (e acute) encodes as C3 A9 in UTF-8 Base16 — two hex pairs — not one. If you are counting bytes or comparing with another system, keep in mind that character count does not equal byte count for any text that uses accented or non-Latin characters.

Everything runs locally in your browser, so nothing you type is uploaded.