Upload a file
  1. base64hub
  2. Other bases
  3. Base64 to hex

Base64 to Hex Converter: Inspect the Raw Bytes

Paste Base64 and see the decoded bytes as hex. Pick lowercase or uppercase, a separator such as : or 0x, and 16 or 32 bytes per line when you want a dump you can read.

Free no sign-up, no limits Local nothing uploaded 16 or 32 bytes per line for a readable dump Updated Oct 27, 2026
Input 0Bytes 0 BOutput 0

Processed in your browser. This page cannot send your data anywhere – how we know

How to convert Base64 to hex

  1. Paste the Base64 into Input · Base64. Line breaks, spaces, missing = padding and URL-safe characters are all accepted.
  2. The bytes appear in Output · Hex. The status line shows Looks like with the detected file type, if the bytes match a known format.
  3. Under the output, choose Case, Separator and Bytes per line.
  4. Copy output or Download the hex. Save bytes writes the decoded bytes themselves as a file.

For the other direction, use the Hex → Base64 toggle or Hex to Base64.

Output options

The Base64 SGkh/w== holds four bytes. The Separator setting decides how they are written:

SeparatorOutputUse it for
None486921ffcomparing with sha256sum output, databases, URLs
Space48 69 21 ffreading byte by byte, hex editors
:48:69:21:ffcertificate and key fingerprints
0x0x48 0x69 0x21 0xffC, C# or Java constants
\x\x48\x69\x21\xffstring literals in Python, C and shell

Case switches to 48 69 21 FF. Bytes per line set to 16 gives the familiar dump layout, 16 bytes to a row, which makes it easy to find offset 0x40 or count a header’s length.

Reading the first bytes

Most file formats start with a fixed signature, and in hex those signatures are easy to recognize. A few Base64 prefixes and what they decode to:

Base64 starts withHexFormat
iVBORw0KGgo89 50 4e 47 0d 0a 1a 0aPNG
/9j/ff d8 ffJPEG
JVBERi025 50 44 46 2d (%PDF-)PDF
UEsDBA50 4b 03 04 (PK)ZIP, and DOCX, XLSX, JAR, APK
H4sI1f 8b 08gzip

When the first bytes match none of these, they may still be text in an unexpected charset, or encrypted data, which looks uniformly random in hex. The list of common Base64 prefixes has many more. If the data turns out to be a file you want to open, Base64 to File previews and saves it.

Comparing digests and checksums

Hex is the format checksum tools print, so converting Base64 to hex is how you compare a value from a header or a config file with your own md5sum or sha256sum:

Where you see itBase64Hex
Content-MD5 header for helloXUFAKrxLKna5cZ2REBfFkg==5d41402abc4b2a76b9719d911017c592
SHA-256 of helloLPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ=2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824

The same applies to integrity="sha384-…" attributes, SSH fingerprints in SHA256: form (Base64 without padding) and binary keys in JSON. If two values differ in hex, they differ in bytes; if they match, any difference in the Base64 was only formatting, such as padding or the URL-safe alphabet.

Base64 to hex in code

import base64
base64.b64decode("SGkh/w==").hex()        # '486921ff'
base64.b64decode("SGkh/w==").hex(" ")     # '48 69 21 ff'
Buffer.from("SGkh/w==", "base64").toString("hex");   // '486921ff'

In Python, b64decode silently drops characters outside the alphabet unless you pass validate=True, so a URL-safe string can decode to the wrong bytes without an error. Node’s "base64" decoder accepts both alphabets. See the Python and Node.js pages for details.

FAQ

How do I decode Base64 to hex on Linux?

echo 'SGkh/w==' | base64 -d | xxd -p prints 486921ff. xxd -p breaks lines every 30 bytes; add -c 32 for 32 bytes per line, or use od -An -tx1 if xxd is not installed.

Why does my hex contain ef bf bd?

Those three bytes are the UTF-8 form of �, the replacement character. Some tool decoded the Base64 to text first and replaced every byte that was not valid UTF-8. Decode straight to hex, as this page does, and the original bytes come through.

How long is the hex compared to the Base64?

About 1.5 times as long. Four Base64 characters hold three bytes, which take six hex digits. A 44-character SHA-256 value becomes 64 hex digits.

Does it accept Base64URL and data URIs?

Yes. - and _ are read like + and /, missing padding is fine, and a data:...;base64, prefix is skipped.