K

Base64 Encode / Decode

Base64 (RFC 4648) encode / decode

Client-side computation for analysis, verification, and learning. Do not paste production secrets into untrusted sites; prefer local tooling for key material.

Educational / engineering use. RSA mode uses tiny primes for illustration only—not for real key generation.

Plaintext (UTF-8)
Output
SGVsbG8sIOS4lueVjA==

Add Base64 Encode / Decode Free On Your Website

Paste this HTML on your site.

What is Base64 Encode / Decode?

Base64 converts binary data into a plain ASCII string using 64 printable characters. Commonly used to safely transmit binary content like images or files through text-based channels such as email or JSON APIs.

Base64 Formula

Every 3 bytes (24 bits) become four 6-bit groups:

output length = ceil(n/3) × 4 characters

Each 6-bit value maps to Base64 alphabet [A–Z, a–z, 0–9, +, /].

Padding "=" is added when input length is not a multiple of 3.

Step-by-Step

  1. Read input data as bytes.
  2. Group bits in 24-bit chunks.
  3. Split into 6-bit values.
  4. Map values to Base64 alphabet.
  5. Add padding "=" when needed.

Worked Example

Input: "Man"

ASCII:M=77,a=97,n=110ASCII: M=77, a=97, n=110

Binary bytes: 01001101 01100001 01101110

Split into 6-bit groups -> decimal indices: 19, 22, 5, 46

Map using Base64 alphabet: 19->T, 22->W, 5->F, 46->u

Encodedresult:Base64("Man")=TWFu.Encoded result: Base64("Man") = TWFu.

Decoding reverses these steps.

Where Base64 Encode / Decode Is Applied

  • Embedding images in HTML/CSS (data:image/png;base64,...)
  • Email attachments encoding (MIME standard)
  • Storing binary data in JSON and XML payloads
  • JWT token structure (header and payload are Base64url encoded)
  • Basic HTTP Authentication (Authorization: Basic header)
  • Encoding cryptographic keys and certificates (PEM format)
  • Storing binary blobs in databases that only support text

Related Cryptography Calculators

Explore similar calculators to streamline your workflow.

View all
Calculator By Adil Balti, Content Proofread and Verify by Muhammad Kumail & Gulzar Abbas.

About Calculators.is

At Calculators.is our sole focus is to provide 100% accurate, fast, comprehensive, convenient, easy-to-use free online calculators to everyone to use without spending a single $ on any online Calculators.

All the calculators on our website are designed and developed by our own team, and each one is put through strict, comprehensive testing before being made live on our website.

About, Founder and calculator.is.