Base64 Encoder and Decoder

Quick answer

The Base64 encoder and decoder converts any text – including accents, other alphabets and emoji, encoded as UTF-8 – into Base64 and back, with the standard or URL-safe alphabet, optional padding and MIME line wrapping, and shows the size overhead.

Result
SGVsbG8sIHdvcmxkISDwn5GL
Bytes of data (UTF-8)
18 bytes
Base64 characters
24
Size overhead of Base64
33.3 %
Padding characters (=)
0

Base64 turns binary data into plain text built from 64 safe characters: A–Z, a–z, 0–9, “+” and “/”. It is how e-mail attachments travel through MIME, how images are embedded in CSS as data URLs, how JSON Web Tokens carry their header and payload, and how credentials are packed into an HTTP Basic Authorization header.

The idea is simple: take the bytes three at a time (24 bits), split them into four 6-bit groups and replace each group with one character of the alphabet. When the input length is not a multiple of three, the last group is padded with one or two “=” signs. The result is always about a third larger than the input – the price of making binary data text-safe.

This tool works on text, so it first encodes your characters as UTF-8 – an “é” becomes two bytes and most emoji four. Decoding reverses the process and tells you whether the bytes form valid UTF-8 text. The URL-safe variant from RFC 4648 swaps “+” and “/” for “-” and “_” so the string can be used in web addresses and file names. Base64 is an encoding, not encryption: anyone can decode it.

How to use the Base64 Encoder and Decoder

  1. What do you want to do?
  2. Input
  3. Alphabet
  4. Line breaks

Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.

How it works

In encode mode the text is converted to UTF-8 bytes, grouped in threes and mapped to the Base64 alphabet, with “=” padding unless you choose the unpadded variant. In decode mode whitespace is ignored, both alphabets are accepted, and the bytes are checked for valid UTF-8 before being shown as text.

Worked example

Encoding “Hi”: the bytes are 72 (01001000) and 105 (01101001). Padded with zeros to 18 bits they split into 010010 | 000110 | 100100 = 18, 6, 36 → “S”, “G”, “k”. Only two bytes were present, so one “=” is added: SGk=. The default text “Hello, world! 👋” is 18 bytes in UTF-8 (the emoji alone takes 4) and becomes 24 Base64 characters.

Where Base64 is used

  • E-mail attachments (MIME, RFC 2045).
  • Data URLs such as data:image/png;base64,….
  • JSON Web Tokens (URL-safe, unpadded).
  • HTTP Basic authentication headers.
  • Storing binary keys and certificates (PEM files).

Tips

  • Internet speeds are in bits per second; file sizes are in bytes (1 byte = 8 bits).
  • Real throughput is usually 80–95% of the nominal link speed.
  • Use binary units (MiB, GiB) when your operating system shows them.
  • Everything is calculated in your browser.

Common mistakes to avoid

  • Forgetting the factor 8 between Mbit/s and MB/s.
  • Ignoring protocol overhead and latency on long transfers.
  • Mixing up network and broadcast addresses in subnetting.

Formula

Every 3 bytes (24 bits) → 4 characters of 6 bits · Output length = 4 × ⌈bytes ÷ 3⌉ · Overhead ≈ 33% · padding "=" fills the last group

Worked example

Inputs — What do you want to do?: Encode text → Base64; Input: Hello, world! 👋; Alphabet: Standard (RFC 4648, + / and = padding); Line breaks: None – one long line.
Results — Result = SGVsbG8sIHdvcmxkISDwn5GL; Bytes of data (UTF-8) = 18 bytes; Base64 characters = 24; Size overhead of Base64 = 33.3 %; Padding characters (=) = 0.

Key terms

Base64 alphabet
The 64 characters A–Z, a–z, 0–9, + and / (or - and _ in the URL-safe form).
Padding
"=" characters that complete the final 4-character group.
UTF-8
The standard way of turning Unicode characters into 1–4 bytes.
MIME
The e-mail standard that wraps Base64 lines at 76 characters.

Frequently asked questions

What does Base64 do?

It represents any bytes using 64 printable characters so binary data can pass through systems that only handle text.

Why does Base64 end with = or ==?

The input length was not a multiple of 3 bytes; one "=" means the last group held 2 bytes, two "=" mean it held 1 byte.

How much bigger is Base64?

Four characters for every three bytes – about 33% larger, plus line breaks if MIME wrapping is used.

Is Base64 encryption?

No. It hides nothing – anyone can decode it instantly. Use real encryption for secrets.

What is URL-safe Base64?

The RFC 4648 variant that uses "-" and "_" instead of "+" and "/", often without padding, used in JWTs and URLs.

What does "Man" encode to?

The bytes 77, 97, 110 become the 6-bit groups 19, 22, 5, 46 – the characters "TWFu".

Can I decode Base64 that contains an image?

Yes, but the result is binary rather than text; the tool reports that and shows the first bytes in hexadecimal.

What formula does the Base64 Encoder and Decoder use?

Every 3 bytes (24 bits) → 4 characters of 6 bits · Output length = 4 × ⌈bytes ÷ 3⌉ · Overhead ≈ 33% · padding "=" fills the last group.

Sources

  1. RFC 4648 – The Base16, Base32, and Base64 Data Encodings
  2. RFC 3629 – UTF-8, a transformation format of ISO 10646
  3. RFC 2045 – MIME Part One

Cite this calculator

Speedy Calculator. (2026). Base64 Encoder and Decoder. Speedy Calculator. https://speedycalculator.com/calculators/other/base64-encoder-decoder/