Skip to content

Base64 encode and decode

Text tools

How do you turn text or a file into Base64?

Encode text or a file to Base64 and decode it back, right in your browser.

Conversion

Alphabet and files

You can also paste a file. Files stay on your device.

Base64

SGVsbG8sIHdvcmxkIQ==

13 bytes become 20 characters

Sponsored Links

Encode text or a file to Base64 and decode it back, right in your browser.

How to use

  1. Choose Encode to turn text into Base64, or Decode to turn Base64 back.
  2. Type or paste the text. To encode a file instead, choose it under Files (up to 5 MB).
  3. Copy the result, or download it as a file.
  4. For web addresses and file names, switch on the URL-safe alphabet.

Base64 padding examples

TextBase64
fZg==
foZm8=
fooZm9v
foobZm9vYg==
foobaZm9vYmE=
foobarZm9vYmFy

How it works

Base64 writes any data, including a picture or a file, using only 64 safe characters: the letters, the digits, plus and slash. That lets binary data travel through places that only handle text, such as email, JSON or a web address. It is a way of writing data, not a way of hiding it: anyone can decode it.

The data is cut into groups of three bytes (24 bits), and each group is written as four characters of six bits each. So Base64 is a third longer than the original, and a final group of one or two bytes is topped up with = signs. For example the text Man becomes TWFu, and f becomes Zg== (RFC 4648). Text is first turned into bytes as UTF-8, so every language and emoji works.

The URL-safe variant swaps + and / for - and _, so the result needs no escaping in an address or file name, and often leaves out the = padding. When decoding, this tool reads both kinds, ignores spaces and line breaks, and rejects anything else. Files up to 5 MB are read and converted in your browser; nothing is uploaded.

Sponsored Links

Frequently asked questions

Is Base64 encryption?

No. Anyone can decode it, so never use it to protect a password or a secret. It only makes data safe to carry as text.

Why is the result longer than the original?

Every three bytes become four characters, so the result is about a third larger. The extra size is the price of using only safe characters.

Why does decoding say the data is not text?

Base64 can hold any file, not just text. If the decoded bytes are not valid UTF-8 text, such as an image, download them as a file instead.

Can I decode Base64 without the equals signs?

Yes. This decoder accepts missing padding when the remaining length is valid.

Does Base64 preserve accented letters and emoji?

Yes. Text is encoded as UTF-8 bytes, so those characters round-trip when decoded as UTF-8.

Sponsored Links

Sponsored Links