⚡ Data URIs & 5 Base64 Variants Supported

Base64 Encoder Online

Encode plain text, images, files, hexadecimal, and binary into Base64 (Standard RFC 4648, Base64URL, MIME, PEM) with Data URI generator (data:image/png;base64,...) and 100% browser privacy.

How to Use the Base64 Encoder

1

Select Input Mode

Choose Plain Text (UTF-8), Hexadecimal, Binary Bits, or File/Image Upload.

2

Choose Base64 Variant

Select Standard Base64 (RFC 4648), Base64URL (JWT Safe), MIME, PEM, or Unpadded Base64.

3

Enable Data URI

Optionally toggle "Data URI Prefix" to generate data:image/png;base64,... schemes for HTML/CSS.

4

Inspect & Copy

Inspect the 24-bit to 6-bit Chunk Matrix, preview live images, and copy or download output.

Understanding Base64 Encoding, RFC Specifications, & Web Performance

Base64 is a binary-to-text encoding scheme defined in RFC 4648 designed to represent arbitrary binary payloads using a 64-character ASCII subset. Base64 is essential across web development, email transport (MIME), OAuth2 / JWT authentication (Base64URL), and cryptographic certificate management (PEM).

How Base64 Bit Chunking Works (24 Bits to 4 Base64 Characters)

In Base64, input data is processed in 24-bit blocks (3 bytes):

  • Every 3 input bytes (24 bits) is divided into 4 six-bit chunks ($4 \times 6 = 24$ bits).
  • Each 6-bit chunk (values 0–63) maps directly to one character in the target Base64 alphabet.
  • If the input byte length is not a multiple of 3, trailing = characters pad the final string to a multiple of 4 characters.
  • Theoretical byte expansion ratio: 1.33x (+33.3% overhead).

Comparison of Major Base64 Variants & Specifications

SpecificationAlphabet ChangesPaddingPrimary Use Cases
Standard Base64A–Z, a–z, 0–9, +, /Mandatory =Data URIs, generic binary-to-text
Base64URL (RFC 7515)A–Z, a–z, 0–9, -, _Unpadded (Strip =)JSON Web Tokens (JWT), OAuth2, URLs
MIME Base64 (RFC 2045)Standard + 76-Char WrapMandatory =SMTP email attachments
PEM Base64 (RFC 1421)Standard + 64-Char WrapMandatory =X.509 Certificates, SSL/TLS keys

100% Local Privacy & Browser Security

Uploaded images, files, and payload data must never be transmitted over the internet to remote servers. Our Base64 Encoder runs 100% locally in your web browser using JavaScript Web Workers. Zero files or data leave your machine.

Frequently Asked Questions

What is Base64 encoding?

Base64 is a binary-to-text encoding scheme defined in RFC 4648 that represents binary data using a 64-character ASCII subset (A-Z, a-z, 0-9, +, /) with = padding. Each character encodes 6 bits of data.

What is a Data URI scheme (data:image/png;base64,...)?

A Data URI allows embedding media files (like images, SVGs, or PDFs) directly into HTML or CSS as Base64 strings, eliminating extra HTTP requests.

What is the difference between Base64 and Base64URL?

Base64URL (RFC 7515 / JWT standard) replaces "+" with "-" (hyphen), "/" with "_" (underscore), and omits trailing "=" padding characters to make output safe for URLs and filenames.

What is MIME Base64 (RFC 2045)?

MIME Base64 formats encoded data for email systems by wrapping lines at 76 characters using CRLF line breaks.

What is PEM Base64 (RFC 1421)?

PEM Base64 formats cryptographic certificates and keys by wrapping lines at 64 characters and adding -----BEGIN CERTIFICATE----- and -----END CERTIFICATE----- header/footer blocks.

Can I encode images or binary files directly to Base64?

Yes! Drag and drop any image, PDF, or binary file to instantly generate Base64 strings and HTML <img> tag Data URIs.

Can I encode Hexadecimal or Binary input?

Yes! Switch input tabs to Hexadecimal (e.g. 48656c6c6f) or Binary Bits (0s and 1s) to encode raw byte streams into Base64.

Is my data or file uploaded to any server?

No. 100% of encoding, bit manipulation, and Data URI generation runs locally inside your web browser using JavaScript Web Workers. Zero files or data leave your machine.

Why does Base64 increase file size by ~33%?

Base64 converts 3 bytes of binary data (24 bits) into 4 ASCII characters (24 bits). This creates a 4/3 ratio, expanding data size by approximately 33.3%.

What is unpadded Base64?

Unpadded Base64 strips trailing "=" padding characters from the output. It is commonly required in JSON Web Tokens (JWT) and URL parameters.

Related Encoding & Decoding Tools