Hex to Base64 Converter
Paste any hexadecimal string and instantly convert it to Base64. Supports raw hex, spaced hex, colon-separated, and 0x-prefixed formats. Reverse conversion and byte inspector included.
Convert Hex to Base64 in Three Steps
No sign-up, no server uploads. Paste, convert, and copy in seconds.
Paste Your Hex String
Paste raw hex (48656c6c6f), spaced hex (48 65 6c), colon-separated (48:65:6c), or 0x-prefixed hex. Upper and lowercase are both accepted. The tool auto-detects the format.
Instant Conversion
Each hex pair is parsed into a byte value (0255). The resulting byte array is then Base64-encoded using the standard RFC 4648 alphabet. Conversion happens in real-time as you type.
Copy or Download
Copy the Base64 output to clipboard with one click, or download it as a .txt file. Switch to Base64URL mode for URL-safe output, or use the byte inspector to analyse your hex data.
Everything You Need for Hex & Base64
A complete conversion toolkit with format flexibility, reverse conversion, and byte-level inspection.
5 Hex Input Formats
Auto-detects raw hex, space-separated, colon-separated, and 0x-prefixed hex. Handles uppercase, lowercase, and mixed case. Strips whitespace and delimiters automatically before conversion.
Base64URL Mode
Switch output to Base64URL (RFC 4648 §5) which replaces + with -, / with _, and omits padding. Essential for JWT tokens, URL query parameters, and filename-safe encodings.
Reverse: Base64 → Hex
Decode any Base64 or Base64URL string back to a hex representation. Choose the output hex format: lowercase spaced, uppercase, raw, colon-separated, or 0x-prefixed.
Byte Inspector
Paste any hex string to see a visual grid of every byte showing its hex value, decimal equivalent, and ASCII character (where printable). Useful for inspecting packet data, hash outputs, and binary streams.
Conversion Stats
After every conversion, see the byte count, input hex character count, output Base64 character count, and the Base64 overhead percentage. Useful for understanding encoding size costs.
100% Private
All conversion uses pure JavaScript running in your browser tab. Nothing is sent to any server. Safe for cryptographic keys, hash values, API tokens, and any sensitive binary data represented as hex.
Hex, Binary & Base64 Examples
How hexadecimal bytes map through binary to Base64 characters. Base64 groups 3 bytes (6 hex pairs) into 4 characters.
| Description | Hex String | Bytes (Decimal) | Binary | Base64 Output |
|---|---|---|---|---|
| "Hello" | 48 65 6c 6c 6f | 72 101 108 108 111 | 01001000 01100101… | SGVsbG8= |
| "Hello World" | 48 65 6c 6c 6f 20 57 6f 72 6c 64 | 72 101 108… 100 | 01001000… | SGVsbG8gV29ybGQ= |
| Zero bytes | 00 00 00 | 0 0 0 | 00000000 00000000 00000000 | AAAA |
| Max bytes | FF FF FF | 255 255 255 | 11111111 11111111 11111111 | //// |
| SHA-256 prefix | e3 b0 c4 42 98 fc | 227 176 196… | 11100011… | 47DEQpj8HBSa+/TI |
| Single byte | 41 | 65 | 01000001 | QQ== |
| Two bytes | 41 42 | 65 66 | 01000001 01000010 | QUI= |
| Three bytes | 41 42 43 | 65 66 67 | 01000001 01000010 01000011 | QUJD |
When You Need Hex as Base64
Converting hex to Base64 comes up frequently across cryptography, networking, and API development.
Cryptographic Key & Hash Encoding
Cryptographic libraries often output keys, IVs, salts, and hashes as hex strings. Many APIs and storage formats (JWT, JWK, PEM headers) expect these values as Base64. Convert your openssl or hashlib hex output here in one step.
Network Packet & Protocol Debugging
Packet capture tools like Wireshark export payloads as hex dumps. Converting those hex bytes to Base64 lets you paste them directly into API test tools (Postman, Insomnia) that expect Base64-encoded binary payloads in JSON request bodies.
JWT & Token Construction
JSON Web Tokens use Base64URL encoding for their header, payload, and signature. When building or debugging JWTs manually, you often need to convert a raw hex signature (from an HMAC or ECDSA operation) to Base64URL. The Base64URL output mode handles this directly.
Database BLOB & Binary Field Handling
Databases like PostgreSQL and MySQL often display binary columns as hex strings in query output. Convert these hex values to Base64 to embed them in JSON API responses, GraphQL fields, or to store them in Base64-compatible text columns.
TLS Certificate & Key Inspection
X.509 certificate fingerprints are commonly shown as colon-separated hex (AA:BB:CC:…). Paste the colon format directly into this tool to convert the fingerprint to Base64 for use in HTTP Public Key Pinning (HPKP) headers or certificate comparison scripts.
Firmware & Embedded Systems Data
Firmware images and memory dumps are routinely exported as hex files or hex strings. Converting sections to Base64 makes them easier to embed in JSON configuration payloads, OTA update APIs, and device provisioning scripts that transport binary data over text-based protocols.
Hex to Base64 Conversion Explained
Hexadecimal is a base-16 number system where each digit represents 4 bits. Two hex digits form one byte (8 bits), ranging from 00 (0) to FF (255). So a hex string is simply a text representation of raw binary data.
Base64 encodes binary data by taking 3 bytes (24 bits) at a time and splitting them into four 6-bit groups. Each 6-bit group maps to one of 64 printable ASCII characters using the standard Base64 alphabet (AZ, az, 09, +, /). If the byte count isn't divisible by 3, padding characters (=) are appended.
The conversion pipeline is: strip hex delimiters → parse pairs into byte values → build a Uint8Array → encode with btoa() or the equivalent Base64URL encoder. The result is always approximately 33% larger than the original byte count.
Frequently Asked Questions
Everything you need to know about converting hex to Base64.
+ with - and / with _, and omits the trailing = padding. This makes the output safe for use in URLs, filenames, and HTTP headers without percent-encoding. Use Base64URL whenever your Base64 value will appear in a JWT, a URL query parameter, a cookie, or any context where +, /, or = would need to be escaped.= characters are appended to reach the required 4-character block length. One = means the original data had 2 bytes in the last group; two == means 1 byte. This padding allows decoders to determine the exact original byte count.AA:BB:CC:DD:EE:FF is handled automatically. The same applies to colon-separated MAC addresses and other colon-delimited hex formats.= padding). This is a common operation when computing Content-Security-Policy script hashes, comparing certificate fingerprints, or preparing HTTP Public Key Pinning header values.parseInt and btoa() functions no third-party libraries, no analytics, no network requests beyond the initial page load.48), the decimal value (e.g. 72), and the ASCII character if the byte falls in the printable range (32126). This makes it easy to spot embedded strings, null bytes, control characters, and high-byte values within a hex payload.