Hex to Base64 Converter
Paste a hexadecimal string and get standard or URL-safe Base64. Spaces, colons, and 0x prefixes are ignored. Everything runs in your browser — nothing is uploaded.
How to convert hex to Base64
The tool parses your hex into raw bytes — ignoring spaces, colons, and 0x prefixes — then Base64-encodes those bytes. Each pair of hex digits becomes one byte, and every three bytes become four Base64 characters. Toggle URL-safe to get the -_ alphabet with padding stripped, which is what you want for JWTs, URLs, and filenames.
Common gotchas
- Odd number of hex digits: every byte is exactly two digits, so a valid hex string always has an even length. An odd count means a nibble is missing or a stray character slipped in.
- Non-hex characters: only
0–9anda–f(any case) are valid. A typo like anofor a0will be rejected. - Hex vs. Base64 confusion: a string that's already Base64 is not hex — feeding Base64 in here will usually fail or produce garbage. Use the Base64 to Hex tool for that direction.
You don't have to clean up your input first: 0x prefixes, whitespace, colons (MAC-address and certificate-fingerprint style), commas, hyphens, and newlines are all stripped for you before decoding.
Is this private?
Yes. The conversion happens entirely client-side in JavaScript. Your hex is decoded and re-encoded in the browser and is never sent to a server. You can confirm this in DevTools → Network: typing fires no request.
Frequently asked questions
How do I convert hex to Base64?
Paste your hexadecimal string into the box above. It parses the hex into raw bytes — ignoring spaces, colons, and 0x prefixes — and then Base64-encodes those bytes. The result appears instantly and runs entirely in your browser.
Why do I get an "odd number of digits" error?
Each byte is exactly two hex digits, so a valid hex string always has an even number of digits. An odd count means a digit is missing or a stray character is present. Check for a dropped nibble — and remember that 0x prefixes, spaces, and colons are stripped before the digits are counted.
Can I paste hex with spaces or colons?
Yes. Whitespace, colons (MAC addresses, certificate fingerprints), commas, hyphens, newlines, and 0x prefixes are all stripped automatically before decoding, so you can paste hex in almost any common format.
How do I go from Base64 back to hex?
Use the Base64 to Hex tool to decode a Base64 string back into a hexadecimal representation of the underlying bytes.
Need plain Base64 encode/decode?
The main base64.dev tool handles text, files, and URL-safe mode with auto-detect.
Open base64.dev →