Home › Text Tools › Base64 & URL Encoder/Decoder

Base64 & URL Encoder/Decoder

Encode and decode Base64 text, and percent-encode or decode URL components.

Base64

URL component

Everything runs in your browser. Nothing you type is sent or stored. Do not paste secrets you would not show to others; encoding is not encryption.

How to use

  1. For Base64, type or paste into the first Text box. Press Encode to turn plain text into Base64, or Decode to turn Base64 back into text. The answer appears in the result panel under the buttons.
  2. For a URL component, use the second Text box. Encode percent-escapes the text, and Decode reverses it.
  3. Each section has its own Clear button. The two sections do not affect each other.
  4. If the input is not valid, the result panel says so. Empty input asks you to type something first.

Worked example

Encoding the text Café ☕ as Base64 gives Q2Fmw6kg4piV. The accented letter and the emoji are first turned into UTF-8 bytes (é is two bytes and ☕ is three), and those bytes are then written in Base64. Decoding Q2Fmw6kg4piV returns Café ☕.

A simpler case: Man encodes to TWFu, Ma to TWE= and M to TQ==. The equals signs are padding.

For a URL component, the text name=Zoë & Co/2024?x encodes to name%3DZo%C3%AB%20%26%20Co%2F2024%3Fx. The equals sign, the ampersand, the slash and the question mark are all escaped, because inside one component they are data and not structure.

How it works

Base64 is defined in RFC 4648. It takes the input three bytes (24 bits) at a time and writes them as four characters of 6 bits each, taken from the alphabet A to Z, a to z, 0 to 9, + and /. When the input does not divide into groups of three, = padding fills the last group. The output is about a third longer than the input. This tool encodes the text as UTF-8 first, so non-English characters round-trip, and it ignores whitespace and line breaks when decoding.

URL encoding, also called percent-encoding, is defined in RFC 3986. Each byte that is not allowed is written as % and two hex digits. This page uses JavaScript's encodeURIComponent, which leaves letters, digits and - _ . ! ~ * ' ( ) alone and escapes everything else. Characters outside ASCII are escaped as their UTF-8 bytes. The MDN reference for encodeURIComponent lists the exact set.

Common mistakes and edge cases

Frequently asked questions

Why does Base64 end with equals signs?

They pad the final group to four characters. One or two may appear. The tool still decodes input that has lost its padding.

Is Base64 the same as encryption?

No. There is no key, and decoding is a fixed public rule. Do not use it to protect passwords or personal data.

Why is the Base64 output longer than my text?

Every three bytes become four characters, so it grows by about 33 percent, more when the text has non-ASCII characters.

What does a malformed encoding error mean?

A percent sign must be followed by two hex digits. Text such as 100% on its own cannot be decoded.

Is anything sent to a server?

No. Encoding and decoding happen in your browser.

Related tools