FormatterHQ

Base64 to Hex

Decode Base64 into hexadecimal bytes — to compare hashes, inspect keys and signatures, or feed binary data into hex-based tools.

Loading tool…
Ready.

How to use the Base64 to Hex

  1. Type or paste into the Base64 box, or click Sample. You can also drop a text file on either box, or load one into the Base64 box with its Open file button.
  2. The Hex box updates live as you type. It works both ways — edit the Hex side to convert back, or click ⇄ Swap to exchange the sides.
  3. Adjust Hex case and Separator in the options bar above the editors; the result refreshes immediately. Alphabet only affects the reverse direction, when you type in the Hex box.
  4. Use Copy or Download on either box to take the result, or Clear to start again.

Base64 to hex for inspecting bytes

The Base64 to hex converter decodes Base64 into raw bytes and prints each byte as two hexadecimal digits. Hex is the lingua franca of binary data — used by hash tools, debuggers, hex editors, protocol specifications and databases — so this is the easiest way to compare a Base64 value with anything else.

Example

Base64 input:

SGVsbG8g8J+Riw==

Hex output (upper case, space separated):

48 65 6C 6C 6F 20 F0 9F 91 8B

Common tasks

  • Comparing digests. An API returns a SHA-256 digest in Base64 while sha256sum prints hex. Convert the Base64 here and compare the two strings directly.
  • Reading SRI hashes. Strip the sha384- prefix from an integrity attribute and convert the rest to see the digest in hex.
  • Inspecting keys, nonces and signatures from JWTs, JWKs and WebAuthn responses, which are Base64URL encoded.
  • Identifying file types. The first bytes reveal the format: 89 50 4E 47 is PNG, 25 50 44 46 is PDF, 1F 8B is gzip.

Output options

  • Case — lowercase matches most hash tools and programming languages; uppercase matches many specifications and hex editors.
  • Separator — space for readability, none for a compact string such as a hash (48656c6c6f), or comma for lists.

For digests, keys and signatures, the lowercase and no-separator settings produce the conventional form that you can compare character by character with other tools or paste into configuration files.

Byte order matters

The hex output lists bytes in the order they appear in the data. If the bytes encode a number — a length field, a timestamp or a counter — remember that many formats store numbers little-endian, least significant byte first. The bytes 10 27 00 00 represent 10,000 in little-endian order but a very different value if read big-endian, so check the specification of the format you are inspecting.

Input handling

Standard and URL-safe Base64 are both accepted, padding is optional and whitespace is ignored. Invalid characters or an impossible length are reported with a clear message. In code, the equivalents are Buffer.from(b64, 'base64').toString('hex') in Node.js and base64.b64decode(b64).hex() in Python.

Convert in the other direction with Hex to Base64, or view the bytes as text with Hex to String. The conversion runs entirely in your browser.

Recognising a digest by its length

When someone hands you a Base64 string and says “it is a hash”, the length usually tells you which one. Base64 turns every 3 bytes into 4 characters, while hex uses 2 characters per byte:

DigestBytesBase64 lengthHex length
MD51624 (ends in ==)32
SHA-12028 (ends in =)40
SHA-2563244 (ends in =)64
SHA-3844864 (no padding)96
SHA-5126488 (ends in ==)128

If the hex output is not one of these lengths, check whether you copied a prefix such as sha256- or {SHA} along with the value. Those labels are not Base64 and change the decoded bytes, even when the decoder does not reject them.

Frequently asked questions

How do I compare a Base64 hash with a hex hash?
Convert the Base64 digest to hex here, choose lowercase with no separator, and compare it with the hex output of your hash tool.
Does it accept Base64URL?
Yes. The URL-safe characters - and _ are handled and missing padding is added automatically.
Why do the first bytes matter?
Many file formats begin with a fixed signature. Seeing 89 50 4E 47 tells you the data is a PNG, for example.
How long is a SHA-256 digest in hex?
64 hex characters, which is 32 bytes. In Base64 the same digest is 44 characters including one = padding character.

Last updated October 3, 2026

Related tools