Base64 & URL Encoder/Decoder
Encode and decode Base64 text, and percent-encode or decode URL components.
Base64
URL component
How to use
- 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.
- For a URL component, use the second Text box. Encode percent-escapes the text, and Decode reverses it.
- Each section has its own Clear button. The two sections do not affect each other.
- 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
- Treating Base64 as security. Anyone can decode it. It is an encoding for carrying bytes through text-only channels, and it hides nothing.
- URL-safe Base64. RFC 4648 also defines a variant that uses
-and_in place of+and/. It is common in tokens and URLs. This tool decodes the standard alphabet only, so swap those characters back before decoding. - Binary data. Decoding must produce valid UTF-8 text. Base64 of an image or other binary data is reported as invalid, because there is no text to show.
- Encoding a whole URL.
encodeURIComponentis meant for one piece, such as a query value. Run on a complete URL it escapes the colons and slashes and breaks it. - Plus signs. In form data a plus can mean a space, but in a percent-encoded component a space is
%20. The decoder here does not turn+into a space. - Double encoding. Encoding an already encoded value turns
%20into%2520. If a link shows%25where you expected%, it was encoded twice.
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
- URL Parser to split a full URL into its parts and see each decoded value.
- JWT Decoder for tokens that use URL-safe Base64.
- HTML Entity Encoder and Decoder for escaping text that goes inside a web page.
- Hash Generator for one-way fingerprints, which are different from encoding.