Hex to Base64 & Base64 to Hex

Converts byte pairs written in hexadecimal to standard Base64, or decodes Base64 back to lowercase hexadecimal. No character-set conversion is applied to these bytes.

Hex To Base64 · Client runtimeSandboxed
Formatted results will render here in real time.

About this hex to base64 & base64 to hex

Converts byte pairs written in hexadecimal to standard Base64, or decodes Base64 back to lowercase hexadecimal. No character-set conversion is applied to these bytes Runs entirely in-memory using Web Crypto primitives to keep sensitive tokens, certificates, and cryptographic keys secure from third-party interception.

Encoding & cryptographic principles

Executes standards-compliant binary-to-text encodings and client-side data compression. Base64 implements RFC 4648 mapping 3 octets (24 bits) into four 6-bit sextets with '=' padding, offering both standard ('+', '/') and URL-safe ('-', '_') alphabets. URL encoding conforms to RFC 3986 percent-encoding for reserved URI characters. Data compression utilizes DEFLATE (RFC 1951), GZIP (RFC 1952), and LZ-String algorithms to compress large text streams directly in browser memory.

Worked verification example

Scenario: Convert a four-byte UTF-8 text value with Hex to Base64 & Base64 to Hex

Sample input:

435a4f41

Second field:

encode

Processing: The client-side engine parses the provided input, executes the transformation routine, and outputs the result in real time.

Illustrative output:

Q1pPQQ==

Security parameters & input constraints

Hexadecimal needs complete byte pairs; spaces, colons, hyphens and 0x markers are accepted. Base64 must use the standard alphabet and zero padding bits. This does not use the Base64url alphabet.

Cryptographic digests, encoded strings, and signatures generated by Hex to Base64 & Base64 to Hex should be verified against target authentication systems before production use.

Client-side Web Crypto boundary

Key derivation, hashing, and encoding in Hex to Base64 & Base64 to Hex execute in local memory using Web Crypto APIs without remote socket transmission.

Cryptographic specifications & RFC standards

Technical specifications and cryptographic RFC standards governing algorithms and key representations:

Hex to Base64 & Base64 to Hex verification · Audit standards

How to use it

  1. Paste the example into “Input”.
  2. Set “Second input / expression” to encode.
  3. Click “Run locally” and compare “Output” with the example.

Frequently asked questions

How does Hex to Base64 encode bytes?+

Encode removes `0x`, whitespace, colons, and hyphens, then requires complete hexadecimal byte pairs and converts those bytes to standard Base64. It does not interpret the bytes as text.

What result should the documented example produce?+

The hex byte string `48656c6c6f` returns `SGVsbG8=`. This is the standard Base64 representation of the five bytes 48 65 6c 6c 6f.

How does decode mode behave?+

Secondary mode `decode` Base64-decodes to bytes and returns lowercase hexadecimal. Invalid Base64 or odd/non-hex encode input raises an error rather than repairing data.

What conversion is not performed?+

It does not translate a character set, preserve source separators, detect a file type, validate a protocol, or prove an encoded value is safe for a particular application.