How to use the Base64 to Hex tool
- Paste the value into the Base64 or Base64 data URL box, or select Example to load a sample.
- Select Decode. Whitespace is ignored and Base64URL is detected automatically.
- Read the bytes in the Result box, written as pairs of hex digits with a space between them.
- Select Copy to copy the hex string, or Clear to start over.
How Base64 to hex conversion works
Base64 and hexadecimal are two ways to write the same bytes as text. Base64 packs 6 bits into each character, hex packs 4 bits into each digit. The tool first decodes Base64 to raw bytes, as described in RFC 4648, then prints each byte as two digits from 0-9 and a-f.
The arithmetic is tidy: four Base64 characters equal three bytes equal six hex digits. So hex is 50% longer than Base64 for the same data, and twice the size of the raw bytes. With the separating spaces, n bytes produce 3n minus 1 characters of output.
Worked examples
The first line is the Example value: thirteen bytes of ASCII text, where 48 is H and 21 is the exclamation mark. The second shows binary data, the four bytes DE AD BE EF. The third is the same value in unpadded Base64URL, which decodes to identical bytes.
SGVsbG8sIHdvcmxkIQ== → 48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 21
3q2+7w== → de ad be ef
3q2-7w → de ad be efOutput format and how to adapt it
The result is always one line in the same shape, which makes it predictable to post-process.
- Lowercase digits. Convert to uppercase in your editor if a tool expects DE AD BE EF.
- One space between bytes. Remove the spaces to get a continuous string such as the output of sha256sum.
- No 0x prefix, offsets or ASCII column. It is a flat byte list, not a full hex dump.
- Leading zeros are kept, so byte 5 prints as 05 and every byte takes exactly two digits.
- Any byte value is valid. Unlike the text decoders, this tool never fails because the data is not UTF-8.
Where hex output helps
Hashes and keys are the main case. Subresource Integrity attributes, JWT signatures and many APIs present digests in Base64, while command line tools print hex. A SHA-256 digest is 32 bytes: 44 Base64 characters with one = sign, or 64 hex digits. The Base64 value 47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU= converts to e3 b0 c4 42 and 28 more bytes, the well-known SHA-256 of empty input.
Hex is also the quickest way to identify a file type. Decode an unknown string and compare the leading bytes with known signatures: 89 50 4e 47 for PNG, 25 50 44 46 for PDF, 50 4b 03 04 for ZIP, 1f 8b for gzip.
Recognizing file signatures in hex
Compare the first bytes with a known file signature. Both standard and URL-safe Base64 can represent the same bytes.
3q2+7w== → de ad be ef
3q2-7w → de ad be ef
iVBORw0KGgo= → 89 50 4e 47 0d 0a 1a 0a (PNG)Frequently asked questions
Is the conversion from Base64 to hex done locally?
Yes. The bytes are decoded and formatted by JavaScript in the page. Keys, hashes and tokens you paste are not transmitted or logged.
How do I get hex without spaces?
Copy the result and remove the spaces with a find and replace. The tool prints a space between bytes for readability and has no option to change the separator.
Why is the hex output longer than the Base64 input?
Hex stores 4 bits per character and Base64 stores 6. Each byte needs two hex digits, and this tool adds a space between bytes, so the output is roughly 2.25 times the length of the Base64.
Can it convert Base64URL from a JWT signature?
Yes. Paste the third segment of the token on its own. The - and _ characters select the URL-safe alphabet and missing padding is accepted. An HS256 signature yields 32 bytes.
What happens with invalid Base64?
The tool shows Enter valid Base64 or Base64URL data and prints nothing. It rejects characters outside the alphabet, padding that does not complete a group of four, and trailing bits that do not belong to a whole byte.
Can I convert hex back to Base64?
Yes, with the Hex to Base64 tool on this site. It accepts hex bytes with or without spaces, colons or 0x prefixes and returns standard padded Base64.