Digital & Developer

Base64 encoder and decoder

Encode text as Base64, or decode Base64 back to text, in your browser.

Free to use No account needed Works in your browser

LET’S GET IT DONE

Your workspace

Standard output keeps plus, slash and equals signs. URL safe output uses minus and underscore, and leaves the equals signs off.
16Characters in the result
StandardAlphabet

Standard Base64. Padding is kept.

Encoding and decoding run in this browser. Base64 is not encryption.

MAKE IT USEFUL

A little context goes a long way.

Turn Unicode text into Base64, or turn Base64 back into text. The conversion stays in your browser. It is the practical way to read a value from a log, a data URL or a JSON field, or to produce one for a test.

01 / USE IT FOR

When it is useful

Read a short message stored as Base64, or prepare a URL safe value for a query string or a config file.

02 / GOOD TO KNOW

Limits to keep in mind

This converts text, not pictures or other files. Base64 is not encryption. Inputs are limited to 200,000 characters, and decoded bytes must be UTF-8 text.

Your content stays yours.

The information you enter here is processed within your browser by this tool, without an account. Do not rely on unverified results for important legal, financial or business decisions.

Read our privacy information →

A CLOSER LOOK

From text to a portable value.

What it does

Base64 writes bytes as ordinary text, using letters, digits, plus and slash. One or two equals signs at the end are padding. They make the length even. They do not hide the data.

Email, data URLs and some JSON fields use it when a channel expects text but the content is bytes. This page turns Unicode text into Base64, and it turns Base64 back into text. Use it to read a block in a log or an export, or to produce a value a form or a test asks for.

The conversion runs in your browser. Nothing is uploaded, and you do not need an account. Base64 is not encryption: anyone can reverse it. A space in a web address is a different encoding, and becomes %20. For that, use the URL encoder and decoder linked below.

How to use it

  1. Choose Encode text or Decode Base64. Each direction keeps its own box, so switching does not wipe the other value.
  2. To encode, paste the text. Standard Base64 keeps plus, slash and equals signs. URL safe Base64 uses minus and underscore, and leaves the equals signs off.
  3. To decode, paste the Base64. Leave Auto on unless you know the form. Auto treats a minus or an underscore as URL safe, and plus or slash as standard.
  4. Read the note under the result. It names the alphabet, and it says when a data URL header was left out. Then copy or download. Download saves a text file on your device.

An empty box waits for input. A value the tool cannot read produces an explanation, not a guess. Spaces you type while encoding are kept. Spaces and line breaks in a Base64 paste are removed, because they are wrapping, not data.

A worked example

The text café & co contains an accent, a space and an ampersand. The encode box starts with this example. Standard Base64 is Y2Fmw6kgJiBjbw==. URL safe Base64 is Y2Fmw6kgJiBjbw. This value has no plus or slash, so only the padding changes.

Choose Decode Base64, leave Auto on, and paste Y2Fmw6kgJiBjbw==. The text comes back. The shorter URL safe form returns the same text. This wrapped copy still decodes:

Y2Fmw6kg
JiBjbw==

The characters >>> become Pj4+ in standard Base64 and Pj4- in URL safe Base64. The characters ??? become Pz8/ and Pz8_. The underscore stands in for the slash, and the minus stands in for the plus.

How the conversion works

The tool first turns the text into UTF-8 bytes. A plain English letter is one byte. The pound sign £ is two bytes and becomes wqM=. The emoji 🙂 is four bytes and becomes 8J+Zgg==, or 8J-Zgg in the URL safe form.

The bytes are taken three at a time. Three bytes are 24 bits, split into four groups of six, and each group is one alphabet character. One leftover byte adds two equals signs. Two leftover bytes add one. The text is longer than the bytes, by about a third.

Decoding reverses those steps. Line breaks, including the wrap email often inserts every 76 characters, are removed first. A data URL is cut at ;base64,, so data:text/plain;base64,Y2FmZQ== is the four letters cafe. Missing padding is restored when the length allows it. The bytes must be valid UTF-8, so an image fails with an explanation rather than becoming nonsense text.

URL safe Base64, also called base64url, swaps plus for minus and slash for underscore. Padding is left off on the way out and accepted on the way in. Spare bits in the final character must be zero, or the copy is rejected. The browser does this with its built in text tools. No request is sent.

Pitfalls and tips

A password or a key encoded this way is still readable. Base64 stops a text channel from breaking on raw bytes. It does not keep a secret. Use encryption when the content must stay private.

Pj4+ and Pj4- are the same three > characters. Forcing the standard alphabet onto a minus or an underscore is reported, not guessed. If a value contains neither plus, slash, minus nor underscore, Auto treats it as standard. The text matches either way, as with the café example.

YQ== and YQ are both the letter a. YQ= is incomplete, and a lone Y is not a whole group. Those two are rejected. Equals signs belong only at the end, and there can be one or two. YR== is rejected because its spare bits are not zero.

JavaScript btoa does not encode UTF-8, so café or £ can throw or disagree with this page. This tool always uses UTF-8. Half of an emoji left by a bad paste is rejected. A word processor can also turn a minus into a longer dash. URL safe Base64 needs the minus key. Copy the value without surrounding JSON quotes. Capitals matter: YQ== and yq== differ.

A JSON Web Token is three parts joined by dots. Paste one part. This page does not check signatures, and the last part is a signature, not a sentence. Dots are rejected so a whole token is not misread. More than 200,000 characters is rejected so the page stays responsive.

Privacy

Encoding and decoding stay in this browser. NetPivotal does not receive the text, store it, or send it to another service. Copy uses the clipboard on your device, and only if you choose Copy result. Download writes a text file on your device in the same way. Close the tab when you are finished if the text was sensitive. Base64 will not make that text secret.

Questions people ask

What is Base64?

It is a text form of bytes. Letters, digits, plus and slash stand for the data, and equals signs are padding. URL safe Base64 uses minus and underscore, and often leaves the padding off.

Is Base64 the same as encryption?

No. There is no key, so anyone can reverse the text. This page will not make a password safe.

Why does decoding fail when the value looks almost right?

The message names the cause. It is usually a mixed alphabet, bad padding, or bytes that are not UTF-8 text, such as an image.

How is this different from the URL encoder?

The URL encoder and decoder percent encodes characters for a web address. Base64 repacks bytes into a 64 character alphabet. A campaign link needs the URL encoder. A data URL needs this page.

Is my text sent anywhere?

No. Conversion happens in this browser. Copy and download stay on your device, and only when you choose them.

Can I decode a whole JSON Web Token here?

Paste a single part, not the whole token. This page does not check signatures. If that part is JSON, the JSON formatter will lay it out. If a nearby field is a numeric time, use the Unix timestamp converter.

Related tools

The URL encoder and decoder is the right tool when a query value contains spaces or accents, and the wrong tool when the field is Base64. The JSON formatter checks that an export is valid JSON and lays it out so a Base64 field is easier to copy. The Unix timestamp converter reads a numeric time from a log or an API.