How to convert Hex to Base64 and Base64 to Hex
- Hex → Base64: paste hexadecimal bytes into the Hex pane (continuous hex like
48656c6c6f, space- or colon-separated bytes like48:65:6c, or0x48, 0x65arrays). The raw bytes are converted directly to Base64 on the right. - Base64 → Hex: paste standard Base64, URL-safe Base64url, or a
data:...;base64,URI into the Base64 pane to inspect the decoded bytes in hexadecimal. - Format options: switch between lowercase and uppercase hex digits, pick a byte separator (space, none, colon, or comma), toggle the
0xbyte prefix, or enable URL-safe Base64url.
Need to convert numeric integers between binary, octal, decimal, and hex? Use the Number Base Converter.
Frequently asked questions
- Why convert hexadecimal to Base64 instead of Base64-encoding the hex string as text?
- A hexadecimal string uses 2 ASCII characters per byte (100% overhead), whereas Base64 uses 4 characters for every 3 bytes (~33% overhead). Converting hex bytes directly to Base64—rather than Base64-encoding the ASCII hex digits—produces a compact representation of the underlying binary key, hash, or digest.
- What hex formats and byte separators are accepted?
- You can paste continuous hex (48656c6c6f), space-separated bytes (48 65 6c), colon-separated MAC/fingerprint notation (48:65:6c), comma-separated arrays (0x48, 0x65), or C/Python hex escapes (\x48\x65).
- Why does an odd number of hex digits produce an error?
- Each byte (8 bits) consists of two 4-bit hexadecimal nibbles (00 to FF). An odd number of hex digits leaves a half-byte nibble with an ambiguous value, so add a leading 0 to any single-digit byte.