Base64 Encoder and Decoder

Type or paste text and copy its Base64, written in the standard alphabet with +, / and =.

FluffyShield Protected workspace
From
To

Convert to

Choose text conversion

FluffyShield

Isolated workspace: other page scripts can't read your files. How FluffyShield works

Free · No upload · No sign-up · No usage quotas

Does your Base64 need + and /, or - and _?

Base64 comes in two spellings that differ only in a few marks. This page writes the standard one, and a web address wants the other.

What the encoder does
  1. Store your text as UTF-8 bytes, the small numbers a computer keeps text in
  2. Write every three bytes as four characters
  3. Fill out a short last group with =

What it does

One line, however long

The Base64 is never broken into lines, so it pastes into a single-line field as it is.

Half an emoji is refused

An emoji is stored in two halves, and text cut between them keeps only one. The encoder stops with "The text has half of an emoji or other two-part character, which can't be saved as UTF-8. Delete it and try again." instead of encoding a broken character.

Limits It decodes only back to text. Bytes that are not text need the hex converter below.

When a form asks for a value in Base64

A settings screen, an app's instructions or a developer friend asks for a short message "in Base64". You type Lunch?🍕 and get back THVuY2g/8J+NlQ==. For most places that ask, that string is exactly right. For a web address it carries three kinds of mark that cause trouble.

Base64 writes with 64 characters: the 26 capitals, the 26 small letters, the ten digits and two more. RFC 4648, the standard that defines it, makes those last two + and /. Both already mean something inside a web address. A slash separates the parts of a path, and in the part after a question mark a + can be read as a space. So the same standard gives a second alphabet, often called base64url, with - in place of + and _ in place of /.

Standard: what this page writesTHVuY2g/8J+NlQ==URL-safe: for web addressesTHVuY2g_8J-NlQ

Two spellings

Only the marks are different. Every letter and digit stands where it stood, and both rows decode to the same 10 bytes. How we checked

Login tokens and other values carried in addresses usually leave the = signs off as well; the rules for JSON Web Tokens drop them by name. This page writes the standard spelling only.

Where the = signs at the end come from

Base64 works through the bytes three at a time and writes each group of three as four characters. Lunch?🍕 is 10 bytes: one for each of the six characters before the pizza, and four for the pizza, because UTF-8 needs that many for it.

That makes three full groups and one byte over. The encoder still writes four characters for that last byte and fills the two it has no data for with = signs. A last group of two bytes gets a single =, so a Base64 string ends in no =, one or two, and the count tells you how full its last group was.

Encoding a line for a web address

The other encodings are in FluffyBench's Base encoder and decoder.

  1. Type or paste your text into the Input box.

  2. Press Copy above the Base64 box. On a phone, that box is under Result.

    The Base64 box holding THVuY2g/8J+NlQ==, with Copy and Download above it.
    The Base64 box holding THVuY2g/8J+NlQ==, with Copy and Download above it.
  3. If the value is going into a web address, change each + to -, each / to _, and drop the = signs.

Reading someone else's Base64

To decode, press the swap button so From is Base64 and To is Text. It reads both spellings: we gave it the URL-safe THVuY2g_8J-NlQ and it read Lunch?🍕 back, even with the = signs left off.

The Base64 holds a picture, a key or other bytes that aren't words

Base64 to Hex (Base16) Converter

It shows every byte as two digits and never tries to read them as letters, so nothing is turned away for not being text.

What you want to encode is a whole file, an image for instance

FluffyBench File to Base64 and data URLs

It reads the file's bytes and gives them back as Base64, on their own or inside a data: address a web page can use.

Search FluffyBench