Tool guide
About Base64 to Hex Converter
Base64 to Hex converts an encoded payload into a plain hexadecimal view of the underlying bytes, so you can read a binary blob one byte at a time instead of guessing what a wall of Base64 characters contains.
It converts in both directions, strips data URI prefixes and PEM header lines, accepts hex with or without 0x and separators, and reports the byte count plus a detected file type when the leading bytes match a known signature.
How to use Base64 to Hex
- Paste the encoded value into the input box; a data:image/png;base64, prefix or the BEGIN and END lines of a PEM block are removed for you, and whitespace is ignored.
- Use the direction button to switch between Base64 to Hex and Hex to Base64.
- For hex input, paste whatever shape your tooling produced: bare digits, a 0x prefix, or bytes split by spaces, colons, or hyphens.
- Turn on uppercase output or spacing between bytes to match the layout used by your debugger or protocol document.
When you would use it
- Inspect the raw bytes of a certificate or key by converting the PEM Base64 body to hex and walking the DER structure by hand.
- Check the magic number at the start of a file or image to confirm its real type instead of trusting the extension.
- Debug binary protocol frames, firmware payloads, or cryptographic test vectors documented in hex but transported as Base64.
- Turn a hex dump from a packet capture tool into Base64 so it can be pasted into a config file or an API request body.
How Base64 and hex encode the same bytes
Both are text representations of the same byte sequence, but they trade density against readability in opposite directions.
- Base64 packs 3 bytes into 4 characters, so the encoded text is about 33 percent larger than the original data.
- The = characters at the end are padding, added when the input length is not a multiple of 3.
- Hex maps 1 byte to exactly 2 characters, doubling the size but keeping a fixed offset for every byte.
- That fixed mapping is why hex wins during debugging: byte 12 always starts at character 24, so spec offsets line up with what you see.
Base64 to Hex FAQ
- Why does my Base64 image or certificate look like garbage in a normal Base64 decoder?
- Most decoders show the result as UTF-8 text. Binary payloads contain byte values that are not valid text, so they render as replacement characters or get mangled. Hex avoids that.
- Can I paste a full PEM block or a data URI?
- Yes. The BEGIN and END marker lines and a data URI prefix are stripped before decoding, and line breaks are ignored.
- What hex formats are accepted going the other way?
- A 0x prefix, plain hex digits, and bytes separated by spaces, colons, or hyphens all work. Separators are removed before the bytes are re-encoded.
- What does the detected file type mean?
- The leading bytes are compared against known signatures for PNG, JPEG, GIF, PDF, ZIP, GZIP, and DER. If nothing matches, no type is shown rather than a guess.
- Is my data uploaded anywhere?
- No. Decoding, re-encoding, and signature detection all happen in your browser, so keys, certificates, and captured frames are never sent to wetool.site.
Base64 to Hex vs a text-oriented Base64 decoder
A general Base64 encoder and decoder takes the UTF-8 text path: it decodes the Base64, then interprets the result as a string. That is fine for JSON and readable tokens, but a PNG header, a DER-encoded certificate, or a binary protocol frame holds byte values with no valid text meaning, so the output arrives garbled and bytes can be lost on the way back. This page never touches the text layer. It converts between Base64 and hex at the byte level, so 0x00, 0xFF, and every invalid UTF-8 sequence survive a full round trip unchanged.
Reading a hex dump byte by byte
Once a payload is in hex, the first few bytes usually tell you what you are holding.
- 89 50 4e 47 is a PNG file, and ff d8 ff marks the start of JPEG data.
- 25 50 44 46 is PDF, 50 4b 03 04 is ZIP or any ZIP-based container, and 1f 8b is GZIP.
- A leading 30 82 is the SEQUENCE tag of a DER structure, which is what a certificate or key body looks like once the PEM Base64 is decoded.
- An odd number of hex digits cannot form whole bytes, so check for a missing digit at the ends of a copied dump.