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
sha256sumprints hex. Convert the Base64 here and compare the two strings directly. - Reading SRI hashes. Strip the
sha384-prefix from anintegrityattribute 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 47is PNG,25 50 44 46is PDF,1F 8Bis 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:
| Digest | Bytes | Base64 length | Hex length |
|---|---|---|---|
| MD5 | 16 | 24 (ends in ==) | 32 |
| SHA-1 | 20 | 28 (ends in =) | 40 |
| SHA-256 | 32 | 44 (ends in =) | 64 |
| SHA-384 | 48 | 64 (no padding) | 96 |
| SHA-512 | 64 | 88 (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.