URL Encoding Explained: When and How to Use It

URL Encoding Explained: When and How to Use It

If you have ever seen %20 where a space should be, you have met URL encoding. It is how URLs safely carry characters that would otherwise have special meaning. Here is what it does and when you need it.

Why URLs need encoding

URLs have a limited set of safe characters. Spaces, and symbols like &, ?, #, /, and =, all have specific roles. To put those characters into a value (say, a search term or a redirect target), they must be percent-encoded so the browser does not misread them.

For example, a space becomes %20, and & becomes %26. Decode it and you get the original text back.

When you need it

  • Query string values: building a link like ?q=cats%20%26%20dogs.
  • Redirect parameters: passing one URL inside another.
  • API requests: encoding values before putting them in a path or query.
  • Debugging: decoding a long, messy URL to read what it actually contains.

Encode or decode in two steps

  1. Open URL Encode / Decode.
  2. Paste your text or URL, choose encode or decode, and copy the result.

It runs in your browser, so nothing is sent anywhere.

Encode the value, not the whole URL

A common mistake is encoding an entire URL when you only meant to encode one value inside it. Encode the individual parameter value, then place it into the query string. Encoding the whole thing turns your ? and & separators into literal characters and breaks the link.

Encode the value, not the separators, and decode anything you cannot read at a glance.

← All posts