Seamlessly convert between Base64 strings and Hexadecimal (base-16) representation. Perfect for debugging binary data, analyzing encoded payloads, and understanding low-level encoding.
Base64 and hexadecimal (hex) are two widely used methods for representing binary data in a textual format. While hex uses base-16 (digits 0-9 and letters A-F), Base64 uses an alphabet of 64 ASCII characters (A-Z, a-z, 0-9, +, /) plus padding (=). Both are essential in modern computing — from data URIs, JSON web tokens, cryptographic keys, to low-level network protocols.
Key difference: Hexadecimal is more human-readable and consumes 2 characters per byte (50% overhead). Base64 is more compact, using ~4 characters per 3 bytes (33% overhead), making it preferable for transmitting binary data over text-based media (email, JSON, URLs).
Base64 → Hex: The conversion algorithm first decodes the Base64 string into its original binary form using the standard Base64 decoding table (RFC 4648). Each group of 4 Base64 characters yields 3 bytes (24 bits). These bytes are then transformed into a hexadecimal representation: every byte (8 bits) maps to two hex characters (0–FF). The process is reversible and deterministic.
Hex → Base64: The hex string is normalized (removing whitespace, '0x' prefix) and validated to ensure even length and valid characters. Then each pair of hex digits is interpreted as a byte. The resulting byte sequence is encoded to Base64 by splitting into 24-bit groups and mapping to the Base64 alphabet, adding padding (=) if necessary.
| Property | Hexadecimal (Base16) | Base64 |
|---|---|---|
| Alphabet size | 16 (0-9, A-F) | 64 (A-Z, a-z, 0-9, +, /) |
| Characters per byte | 2 characters | ~1.33 characters (4 chars / 3 bytes) |
| Overhead | 100% (2x original size) | 33% |
| Human readability | High (familiar hex dumps) | Moderate (compact but opaque) |
| Typical use | Debugging, memory dumps, color codes | Email attachments (MIME), JWT, API tokens |
| Standard reference | RFC 4648 (Base16) | RFC 4648 (Base64) |
A developer receives a Base64-encoded refresh token in a mobile app log: dGhpc2lzYXRlc3R0b2tlbjEyMw==. Converting it to hex yields 7468697369736174657374746f6b656e313233, which immediately reveals ASCII characters: "thisisatesttoken123". This demonstrates how hex conversion can be used for rapid forensic analysis. Using our tool, security analysts can verify token structure without writing custom scripts.