TOP

Free exact browser converter

Base64 to Hex Converter

Decode Base64 or Base64url into hex bytes online. Preserve leading zeros, validate padding and pad bits, and choose uppercase, lowercase, or spaced hex.

No signupRuns locally in your browser

Interactive tool

Convert Base64 to Hex

Ready

Output format

Choose a clear output representation.

Detailed conversion guide

How to Convert Base64 to Hex

Validate the Base64 alphabet and padding, normalize Base64url characters when present, decode the complete byte sequence, and write each byte as exactly two hex digits. QQD/ decodes to 41 00 FF.

Hex output preserves zero bytes and byte order even when the bytes are not valid UTF-8 text. Uppercase, lowercase, and spaced formatting change presentation only. Standard /w== and Base64url _w both decode to FF.

InputOutputMeaning
AA==00one zero byte
/w==FFone byte 255
QQD/4100FFthree raw bytes
SGVsbG8=48656C6C6FUTF-8 bytes of Hello

Base64 Decode to Two-Digit Hex Bytes

The algorithm validates the byte representation before conversion. Invalid input clears the result and shows a warning.

// Run alphabet, length and canonical pad-bit checks first.
const raw = atob(validatedStandardBase64);
const hex = [...raw].map(c => c.charCodeAt(0).toString(16).padStart(2,"0")).join("").toUpperCase();

Malformed Padding and Binary Payloads

Invalid characters, embedded padding, impossible lengths, mixed standard/URL alphabets, and non-zero unused pad bits are rejected. For example Zg== is valid for byte 66, while Zh== is rejected despite permissive decoders accepting it.

Padded input needs the proper length and trailing = count. Unpadded input is accepted when it can be completed to canonical Base64. Whitespace may wrap the input. Remove a data: header before conversion; no text encoding or integer value is inferred.

Related converters

Choose a converter for the formats you are working with.

Advertisement

Sponsored link