Base64 to Hex Converter (and back)
Convert a Base64 string to hexadecimal bytes and hex back to Base64, with URL-safe support, in your browser.
How to use
- Choose the direction: Base64 to hex, or hex to Base64.
- For Base64 to hex, pick the byte separator and letter case.
- Toggle URL-safe Base64 if your data uses - and _ instead of + and /.
- Paste your input and copy the converted result.
About this tool
ShowHide
Convert between Base64 and hexadecimal directly, without decoding to text in between — the two are just different ways of writing the same bytes, and a round trip through text would mangle anything that is not valid UTF-8. It is the bridge you want when a certificate fingerprint is quoted in hex but the key is in Base64, when a hash arrives in one form and your tool expects the other, or when comparing a signature against a spec. Hex input is read leniently: 0x and backslash-x prefixes, spaces and colons are all stripped before parsing, so hex copied from a packet dump or a certificate viewer works as is. Base64 must be the standard alphabet — swap any dash or underscore from a URL-safe variant back to plus and slash first.
Frequently asked questions
What is the difference from a normal Base64 or hex tool?
Text encoders convert characters to Base64 or hex. This converts directly between the two byte representations — Base64 in, hex out, or hex in, Base64 out — without assuming the bytes are text.
What hex formats can I decode?
Any. Spaces, colons, newlines and 0x or \x prefixes are stripped, then the remaining hex digits are read two at a time. An odd number of digits is reported as an error.
What does URL-safe Base64 do?
It uses - and _ instead of + and / and omits = padding (RFC 4648 §5). Enable it to decode such input or to produce URL-safe output.
Is my data sent anywhere?
No. The conversion happens entirely in your browser; nothing is uploaded.
Two different Base64 strings gave me the same hex — is that a bug?
No, it is how Base64 works. The final character of an unpadded group carries spare low bits that decode to nothing, and the browser's decoder ignores them rather than rejecting the input, so QQ== and QR== both produce the single byte 41. Converting back always emits the canonical form (QQ==), which is why a Base64 → hex → Base64 round trip can hand you a different string than you started with. The bytes are identical; only the non-canonical spelling is lost.
Which encoding is more compact for a key or a hash?
Base64, by a wide margin. Hex is exactly two characters per byte — 100% overhead — while Base64 is four characters per three bytes, about 33%. A 32-byte key is 64 hex characters, 44 standard Base64 characters, or 43 in URL-safe form once the padding is dropped. Hex wins on readability instead: you can point at byte 7 by counting, and a single-character typo is always caught, whereas in Base64 one wrong character silently shifts three bytes.
Related tools
Text to Hex Converter (and back)
Convert text to hexadecimal bytes and decode hex back to text, with UTF-8 support, in your browser.
Convert
Random Bytes Generator
Generate cryptographically secure random bytes in 9 output formats — hex, Base64, Base64URL, binary, decimal, C array, Python bytes, UUID v4.
Random
Base64 Encoder / Decoder
Encode text to Base64 or decode Base64 back to text, instantly.
Developer
Data URI Parser & Decoder
Decode a data: URI to see its MIME type, encoding, size and decoded contents, in your browser.
Developer
Protobuf Decoder (no .proto needed)
Paste base64 or hex protobuf bytes and read the fields — numbers, wire types, nested messages, strings and packed arrays — without a schema.
Developer
JWK to PEM Converter (and back)
Turn a JWK or a whole JWKS into PEM public keys and back, with the RFC 7638 thumbprint for each — computed in your browser.
Developer