URL encoding guide

URL encode vs decode

Encoding prepares text for a URL. Decoding turns percent-encoded text back into something humans can read.

Open URL Encode Decode Tool View all tools

The difference

Use encode when a value is going into a URL. Use decode when you are reading a value that has already been escaped, such as a query string copied from logs.

Example

Input

Encode: url space encoder
Decode: url%20space%20encoder

Output

Encoded: url%20space%20encoder
Decoded: url space encoder

How to choose

  1. Choose Encode for raw text, spaces, symbols, and callback values before they go into a URL.
  2. Choose Decode for percent-encoded text when you need to inspect what it says.
  3. If decoding still leaves percent signs, the value may have been encoded more than once.

A simple mental model

Encode before text goes into a URL. Decode when you are reading a URL and need to understand what a value says.

If the result still contains percent signs after decoding, it may be encoded in layers. Decode once, inspect the text, then decide whether another pass makes sense.

Common mistakes

  • Decoding a value before sending it to an endpoint that expects encoded text
  • Encoding an already encoded value and changing %20 into %2520
  • Using a decoded callback URL directly inside another query parameter
  • Assuming readable text is always safe to paste into a URL

Related problems

FAQ

What does URL encoding do?

It replaces unsafe characters with percent-encoded sequences, such as converting a space to %20.

What does URL decoding do?

It converts percent-encoded sequences back into readable characters.

Why do I sometimes need to decode twice?

Some systems encode values in layers. Decode one layer at a time so you can see what changed.