Base64 to Hex Converter

Paste Base64 and see the same bytes as hexadecimal. Useful for comparing hashes, inspecting keys and signatures, and matching fingerprints that different tools print in different formats.

Runs entirely in your browser. Nothing is uploaded.

How to use

  1. Paste the Base64 string into the input. Base64 is preselected as the source and hex as the target.
  2. Read the hexadecimal output, two hex digits for every byte.
  3. Pick another target encoding, such as Base58 or Base32, if you need a different format, or press Swap to convert hex back to Base64.
  4. Copy the result.

Two ways to write the same bytes

Hex and Base64 both write binary data as text. Hex spends two characters on each byte, which makes individual byte values easy to read and compare. Base64 packs 3 bytes into 4 characters and is about a third shorter. Converting between them changes only the notation, never the data:

ValueBytesHex lengthBase64 length
MD5 hash163224
SHA-1 hash204028
SHA-256 hash, Ed25519 public key326444
SHA-384 hash489664
SHA-512 hash, Ed25519 signature6412888

Hex is also what hex editors, packet analysers and debuggers display, so converting Base64 to hex lets you line the data up with what those tools show.

When you need hex from Base64

  • Comparing hashes. Tools such as sha256sum print hex, while Subresource Integrity attributes, Content Security Policy hashes and checksum headers such as Content-MD5 use Base64. Convert one side to compare them.
  • SSH fingerprints. ssh-keygen -l prints SHA256: fingerprints as unpadded Base64, while SSHFP DNS records store the same SHA-256 digest in hex. Paste the part after SHA256: to get the hex form.
  • Keys, IVs and signatures. When debugging cryptographic code, seeing the bytes in hex makes it easy to check the length, compare values and spot a missing or extra byte.

Input the converter accepts

Spaces and line breaks in the Base64 input are ignored, the URL-safe characters - and _ are accepted, and = padding is optional, so values copied from JSON, JWTs or terminal output can be pasted as they are. The conversion works on the decoded bytes: the result is the hex of the data, not of the Base64 characters themselves. To see the hex codes of a piece of text, use Base16 instead.

# Shell
printf '%s' "$B64" | base64 --decode | xxd -p

# Python
base64.b64decode(s).hex()

// Node.js
Buffer.from(s, 'base64').toString('hex')

Frequently asked questions

Does this convert the Base64 text or the bytes it represents?
The bytes. The Base64 is decoded first and each resulting byte is written as two hex digits. If you want the character codes of the Base64 string itself, encode it as text with the Base16 tool.
Why is the hex output longer than the Base64 input?

Hex needs 2 characters per byte, while Base64 needs about 1.33. A 32-byte SHA-256 digest is 44 characters in Base64 and 64 characters in hex.

How do I get uppercase hex or colon separators?
Hex digits are case-insensitive, so lowercase and uppercase values are equal. For a particular style, paste the hex into the Base16 encoder as hex input and choose Uppercase, a space or colon separator, or a 0x prefix.
Can I convert Base64URL values from a JWT or JSON Web Key?

Yes. The URL-safe characters and missing padding are handled automatically, so key parameters and signatures can be pasted without changes.