Skip to content
MtrXTools

Base64 / Base32 / Base58

Encode text or a file to base64, base64url or a data: URI, and decode base64 back to text or a downloadable file, with the file type recognised and images previewed. Also handles base32 (TOTP secrets), Base58 and Base58Check (Bitcoin) and Ascii85 / Z85. Unicode is handled as UTF-8. Runs in your browser.

What it does

  • Encodes text as UTF-8, so accented letters, other alphabets and emoji survive (plain btoa() fails on them).
  • Encodes a file to base64 and to a ready-to-use data: URI for CSS or HTML.
  • Decodes standard base64, the URL-safe base64url alphabet (- and _, used in JWTs) and data: URIs, with or without padding and line breaks.
  • Recognises what decoded binary is (PNG, JPEG, GIF, WebP, PDF, ZIP, gzip or DER certificate data), previews images, and lets you download the file.
  • Explains why invalid input won't decode: a character outside the alphabet, padding in the middle, mixed alphabets, or a length that means the text was cut off.
  • Also encodes and decodes base32 (RFC 4648 and base32hex, as used for TOTP secrets), Base58 and Base58Check (Bitcoin addresses and keys, with the checksum verified), and Ascii85 (Adobe, with <~ ~>) and Z85 (ZeroMQ). Tick "Input is hex" to encode raw bytes.

Base64 is an encoding, not encryption

Base64 turns bytes into 64 printable characters so binary data can travel through text-only channels: email attachments (MIME), JSON and XML fields, HTTP Basic authentication headers, Kubernetes secrets and data: URIs. Anyone can decode it, so it hides nothing: a Kubernetes secret or a Basic auth header in base64 is as readable as plain text.

Which alphabet to use

  • Base64: the default for binary in text formats. About 33% larger than the data.
  • Base32: letters A-Z and digits 2-7 only, so it survives case changes and is easy to type. 2FA (TOTP) secrets such as JBSWY3DPEHPK3PXP are base32. About 60% larger.
  • Base58: no 0 O I l or punctuation, so it can be read aloud and double-clicked as one word. Bitcoin addresses, IPFS hashes and Solana keys use it; Base58Check adds a 4-byte checksum that catches typos.
  • Ascii85 and Z85: 4 bytes in 5 characters, only 25% larger. Ascii85 appears in PDF and PostScript files; Z85 is ZeroMQ's variant that is safe inside source code strings.

Questions

What is the difference between base64 and base64url?
base64url (RFC 4648 section 5) replaces + and / with - and _, and usually drops the = padding, so the result is safe in URLs and file names. JWTs, WebAuthn and many APIs use it. The decoder accepts both.
Why is the output a third larger than the input?
Base64 turns every 3 bytes into 4 characters, so encoded data is about 33% larger, plus line breaks if it is wrapped at 76 characters for email.
Why does decoding give strange characters?
The data was binary (an image, a compressed file, a certificate) or text in an encoding other than UTF-8. The tool shows binary as a hex dump with the file type it recognises and a download button.
How do I read a 2FA secret key?
Choose Base32 and paste the secret from the authenticator setup page (the secret= value in an otpauth:// link). Spaces and lower case are fine. The result is the raw HMAC key, shown as hex because it is random binary.