Base64 to Hex Converter — Decode Base64 to Hexadecimal Online

Convert between Base64 and hexadecimal encoding formats. Decode Base64 strings to hex bytes or encode hex to Base64 — with options for uppercase, space-separated bytes, and 0x prefix.

Base64 → Hex

Output format

Hex → Base64

Base64 vs Hex: Understanding the difference

Base64 and hexadecimal are both ways to represent binary data as text. Hex uses 16 characters (0-9, A-F) and produces 2 characters per byte, while Base64 uses 64 characters and produces roughly 1.33 characters per byte — making Base64 about 33% more compact than hex for the same data.

Converting between these formats is common when working with cryptographic hashes (often displayed as hex) that need to be transmitted through APIs or protocols expecting Base64. This tool handles the conversion instantly in your browser.

When hex is preferred

  • Displaying cryptographic hashes (SHA-256, MD5, HMAC)
  • Debugging binary protocols and network packets
  • Color codes in CSS and design tools

When Base64 is preferred

  • Embedding data in JSON, XML, or HTML
  • Email attachments and MIME encoding
  • Data URIs for inline images and fonts

FAQs

What is the difference between Base64 and hexadecimal?

Hexadecimal (base-16) uses characters 0-9 and A-F, producing 2 characters per byte. Base64 (base-64) uses a 64-character alphabet (A-Z, a-z, 0-9, +, /), producing about 1.33 characters per byte. Base64 is more compact, while hex is more human-readable for byte-level inspection.

Can I convert hex strings with spaces, colons, or 0x prefix?

Yes. The tool automatically strips spaces, colons, dashes, dots, and the 0x prefix before converting. Paste hex in any common format — the converter handles it all.

Is the conversion between Base64 and hex lossless?

Yes. Both Base64 and hex are exact representations of binary data. Converting in either direction preserves the underlying bytes with zero data loss.

Why would I need to convert Base64 to hex?

Common use cases include inspecting cryptographic hashes received as Base64 in API responses, debugging binary payloads, comparing encoded values across systems that use different formats, and verifying data integrity during format conversions.

Outils associés