Skip to content
Text Cleanup Tools

Text Cleanup Tools › Guides

URL encoding vs Base64: what each does and when to use it

Both turn awkward text into a safe set of characters, which is why they get mixed up. They solve different problems, and neither one hides anything.

URL encoding (percent-encoding)

A URL can only contain a limited set of characters, and some of them, such as ? & = # and /, have a job in the address. Anything outside the safe set, including spaces, accented letters and emoji, is written as a percent sign and the byte values in hexadecimal. A space becomes %20, and é becomes %C3%A9 because it takes two bytes in UTF-8.

Use it whenever text goes inside a URL: a search term, a file name in a path, or a value in a parameter.

Which URL encoding mode to use

  • A part of a URL, such as one parameter value: encode it as a URL part. This also encodes / ? & = and #, so the value cannot break the structure of the address.
  • A complete address that only contains a few unsafe characters: encode it as a whole URL, which leaves the structural characters alone.
  • Form data: spaces are written as + instead of %20 in the traditional form format. The plus option handles this in both directions.

Base64

Base64 is for a different problem: carrying data, often binary, through a place that only handles text. It writes every three bytes as four characters from a set of 64 (letters, digits, + and /), and pads the end with = signs. The result is about a third larger than the original.

You meet it in data URLs, email attachments and in the parts of web tokens such as JWTs, which use the URL-safe form.

The URL-safe variant

The ordinary Base64 alphabet contains + and /, which have meanings inside a URL. The URL-safe variant swaps them for - and _ and usually drops the = padding. If a Base64 string is going into an address or a file name, use that form.

Common mistakes

  • Encoding twice. A percent sign is itself encoded as %25, so a space that has been encoded twice shows up as %2520.
  • Using URL part encoding on a full address, which turns the colon and slashes into codes and breaks the link.
  • Putting ordinary Base64 into an address without the URL-safe form.
  • Treating either as security. Both are reversible by anyone, so neither protects a password or a secret.

Quick comparison

  • Purpose: percent-encoding makes text safe inside a URL; Base64 makes data safe inside a text-only channel.
  • Size: percent-encoding grows only the unsafe characters; Base64 always grows by about a third.
  • Readability: percent-encoded text is still mostly readable; Base64 is not.

Try it

The URL Encoder and Decoder and the Base64 Encoder and Decoder run in your browser, so what you paste is not uploaded. Both handle accents and emoji as UTF-8.

Tools used in this guide

More guides

Last reviewed 2026-10-15.