Base64 encoder / decoder

Convert text or files to Base64 and back. UTF-8 safe, URL-safe variant supported, and a one-click "encode this file" mode for images, PDFs, and any binary content.

Base64 encoder/decoder

Input0 bytes
Output0 chars
Encode a file No file chosen

How Base64 works

Base64 takes 3 input bytes (24 bits) and turns them into 4 output characters (6 bits each). When the input length is not a multiple of 3, the encoder adds = padding so the output is always a multiple of 4 characters.

Encoded length = ceil(input length ÷ 3) × 4

That means Base64 inflates size by ~33%. A 1 MB file becomes ~1.37 MB encoded.

Standard vs URL-safe

VariantAlphabetUse
Standard (RFC 4648 §4)A-Z a-z 0-9 + /JSON, MIME, generic data interchange
URL-safe (RFC 4648 §5)A-Z a-z 0-9 - _URLs, filenames, JWT tokens

Common uses

  • Embedding images directly in CSS or HTML via data:image/png;base64,… URIs.
  • Sending binary attachments through email (MIME).
  • Storing binary data in JSON or YAML configuration.
  • Encoding credentials in HTTP Basic Auth headers.
  • Carrying signed tokens like JWTs that must travel via URL or cookie.

FAQ

Is anything sent to your server?

No. All encoding/decoding (including file uploads) runs locally in your browser using the Web Crypto and FileReader APIs.

What is the max file size?

Limited only by your browser's available memory. Files up to ~50 MB encode comfortably; larger files may be slow but should still complete.

Can I decode a Base64 image back to a file?

This tool focuses on text output. To save decoded binary as a file, paste the Base64 into a data URI: data:application/octet-stream;base64,… and your browser will offer to download.

Related tools