Base64 ⇄ Hex
Convert Base64, Base64URL and hex with strict validation, exact byte counts and downloads.
This tool runs entirely in your browser. Your data is never uploaded, never stored, and never leaves your device.
Convert between Base64 and hexadecimal without text decoding, compare expected bytes, and download the exact binary data.
How to use it
- 1Choose the conversion direction and enter up to 1 MiB of bytes.
- 2Select standard or URL-safe Base64; explicitly allow whitespace or unpadded input if needed.
- 3Optionally enter an expected value in the opposite representation.
- 4Convert, inspect the byte comparison, then copy or download the complete output.
Example
- Input
- AP8QQUI=
- Output
- 00 ff 10 41 42
Five unchanged bytes, including a leading zero and a non-text FF byte.
What happens to your data
Values are converted locally without uploading or browser-storage persistence. Copy and download create separate copies. Encoding is not encryption.
Last updated October 2026
Convert Base64 directly to hexadecimal bytes, or turn hex bytes into Base64. This is a binary inspection tool: a zero byte stays 00, FF stays FF, and the order of the bytes is preserved. It does not try to interpret binary data as UTF-8 text.
Use it when an API returns an encoded digest, a test fixture stores binary bytes in Base64, or a debugging log shows hex instead. The optional comparison checks the decoded bytes against an expected value and reports the first differing byte offset. Formatting differences in hex do not change the comparison.
How it works
Choose Base64 → Hex or Hex → Base64, enter a value and select Convert bytes. The example AP8QQUI= becomes 00 ff 10 41 42: five bytes including a leading zero and FF, which is not a standalone valid UTF-8 character. Convert the same hex back to obtain the original Base64.
Standard Base64 uses + and /, while Base64URL uses - and _. The selected alphabet is enforced; mixed alphabets are rejected. Padding is required when needed unless Allow unpadded Base64 input is enabled. Missing padding can be accepted by that explicit option, but incorrect, interior or excessive = characters remain errors. The decoder also rejects nonzero unused pad bits: Zh== is not accepted as an alternative spelling of the canonical Zg==. Ignore ASCII whitespace accepts only spaces, tabs, carriage returns and newlines. Data URL prefixes, Unicode whitespace and punctuation outside the alphabet are rejected.
Hex accepts complete byte pairs in a compact string, or pairs separated by spaces, commas or colons. Each separated byte may have an optional 0x prefix. A dangling digit, trailing comma, repeated comma or invalid letter is an error. This is a byte sequence, not a number parser: it neither reverses endianness nor drops leading zeros. Uppercase and byte-spacing controls change presentation only.
The optional comparison expects the opposite representation: expected hex when converting from Base64, or expected Base64 when converting from hex. A mismatch reports a zero-based byte offset and both lengths; an extra byte at the end also counts as a mismatch. Comparison uses the same alphabet and padding rules as conversion. Changing any input or option clears the prior result until you convert again.
Inputs are limited to 1 MiB of decoded bytes. Encoded Base64 input permits up to its maximum encoded length plus 4,096 characters for whitespace; hex input is capped at six characters per maximum byte. The result preview shows at most 40,000 characters, while Copy full result and Download text include the complete output. Download bytes saves the same decoded data as a .bin file. The conversion does not upload your values or save them in browser storage; copying and downloading create separate copies. Base64 and hexadecimal do not provide encryption or secrecy.
Worked example: inspect binary bytes without text decoding
- Input
- AP8QQUI=
- Result
- 00 ff 10 41 42
Five bytes. Converting this hex back with standard padded Base64 returns AP8QQUI=.
Common use cases
- Comparing an API digest with a hexadecimal reference
- Inspecting binary test fixtures that contain zero or non-text bytes
- Changing the display format of a token without changing its bytes
- Downloading a small binary fixture from a verified Base64 or hex value
Frequently asked questions
How do I convert Base64 to hex?+
Select Base64 → Hex, paste raw Base64, choose its alphabet and select Convert bytes. The output shows two hexadecimal digits per decoded byte. Use the byte example to see AP8QQUI= become 00 ff 10 41 42.
Why is my Base64 valid elsewhere but rejected here?+
Some decoders ignore arbitrary punctuation or nonzero pad bits. This tool checks the whole value and requires canonical pad bits. Explicit options allow ASCII whitespace or omitted padding, but do not allow mixed alphabets, misplaced padding or other invalid characters.
Does hex conversion change byte order?+
No. Bytes retain their original order. Hex 00 ff 10 means three bytes in that order, including the initial zero. It is not treated as a number or converted between little-endian and big-endian storage.
Can I convert Base64URL?+
Yes. Select URL-safe (- and _) under Base64 alphabet. Enable Allow unpadded Base64 input if padding was omitted. For hex-to-Base64 output, Include Base64 padding controls whether required = characters are written.
What does byte offset 0 mean in a mismatch?+
Offsets start at zero, so offset 0 is the first byte and offset 4 is the fifth. If one value is a matching prefix of the other, the first offset beyond the shorter value is reported.
Is this suitable for encrypting a secret?+
No. Anyone can reverse hex or Base64 without a key. The conversion runs locally, but clipboard history, downloaded files, browser extensions and access to your device can expose its contents.
Standards and limitations
Related tools
Base64 Encoder & Decoder
Encode and decode text or files with Base64, Base64URL, data URI detection, preview and download.
Hex / Binary / Text Converter
Convert UTF-8 text, hex and binary in six directions, validate input and download original bytes.
Hash Generator
Hash text or hex bytes with SHA algorithms, compare an expected digest and download results.
WebSocket Tester
Test WebSockets with text or binary messages, subprotocols, close diagnostics and log export.