Base64 Encoder and Decoder

Base64 turns any data into 64 safe characters (A–Z, a–z, 0–9, + and /) so it can travel inside text such as email, JSON or web pages. Every 3 bytes become 4 characters, so encoded data is about 33% larger. “Math” encodes to TWF0aA==.

FreeNo sign-upPrivate
4input bytes8output characters

How to use the Base64 tool

  1. Choose Encode or Decode.
  2. Type or paste text, or pick a file to encode. Files are read in your browser and never uploaded; for files you also get a ready-made data URI.
  3. Tick URL-safe for web addresses and tokens, or add line breaks for email (MIME) format.

How Base64 encoding works

  1. Write the bytes in binary. “Mat” is 77, 97, 116 = 01001101 01100001 01110100.
  2. Split the 24 bits into four groups of 6: 010011 010110 000101 110100 = 19, 22, 5, 52.
  3. Look up each number in the alphabet A–Z (0–25), a–z (26–51), 0–9 (52–61), + (62), / (63): T, W, F, 0. So “Mat” → TWF0.
  4. If the last group has only 1 or 2 bytes, pad with = signs. “Math” (4 bytes) becomes TWF0aA==.

Size and uses

Every 3 bytes become 4 characters, so Base64 output is about 4 ÷ 3 ≈ 1.33 times the input size, plus padding. It is used for email attachments, images embedded in web pages and CSS (data URIs), API keys and tokens, and storing binary data in JSON or XML. Base64 is an encoding, not encryption: anyone can decode it, so it does not hide secrets.

Base64 practice questions

Test yourself with 6 multiple-choice questions. Choose an answer and press Submit to see if you are right and why. Your score appears at the end.

Question 1 of 6
1. How many characters does Base64 use (not counting the = padding)?

Found a mistake? Let us know!

2. How many Base64 characters do 3 bytes become?

Found a mistake? Let us know!

3. About how much bigger is Base64 than the original data?

Found a mistake? Let us know!

4. Is Base64 a way to encrypt passwords?

Found a mistake? Let us know!

5. How many bits does each Base64 character carry?

Found a mistake? Let us know!

6. What does URL-safe Base64 replace + and / with?

Found a mistake? Let us know!

Frequently asked questions

What is Base64 used for?

It lets binary data such as images, files or keys travel through systems that only handle text, like email, JSON and HTML.

Why does Base64 end with = or ==?

The = signs are padding. Base64 works in groups of 3 bytes; when the data length is not a multiple of 3, one or two = signs fill the last group.

Can Base64 handle emojis and accented letters?

Yes. This tool first turns text into UTF-8 bytes, so any language and emoji encode and decode correctly.

Is it safe to paste private data here?

The conversion runs in your browser and nothing is sent to a server. Remember that Base64 itself is not encryption.

Sources

Related tools

Browse all calculators and tools

Related to This Article

What people say about "Base64 Encoder and Decoder: Text and Files, UTF-8 Safe"?

No one replied yet.

Leave a Reply