URL guide

URL decode not working fix

URL decoding goes wrong when percent escapes are broken, plus signs are misread, or the value was encoded more than once.

Open URL Encode Decode Tool View all tools

Why decoding gives the wrong result

A URL decoder expects clean percent-encoded text. A percent sign needs two hex characters after it. A plus sign may mean space in a form value but not everywhere. Redirects and tracking links can also encode the same value twice.

Example

Input

name=dev%2520tools

Output

First decode: name=dev%20tools
Second decode: name=dev tools

How to debug the value

  1. Decode one layer, then stop and inspect the result before decoding again.
  2. Look for malformed percent sequences, such as a lone percent sign or non-hex characters after it.
  3. Decide whether plus should become space by checking whether the value is form-encoded.
  4. For a nested URL inside a parameter, decode the parameter value rather than flattening the whole outer URL.

Double encoding

Double encoding is easy to spot when %25 appears. The value %2520 becomes %20 after one decode, then a space after the second decode.

A second decode is not always right. The remaining percent sequences may belong to a nested URL, or they may be literal text the application expects to keep.

Unicode and copied text

Non-ASCII text is usually UTF-8 bytes written as percent sequences. If the decoded text is garbled, the original may have used another encoding or the copy may be incomplete.

Clean surrounding punctuation, quotes, and HTML entities before decoding. A decoder wants the encoded value, not a paragraph copied from a rendered page.

Common mistakes

  • Decoding the whole URL and breaking separators that should remain structural
  • Turning every plus sign into a space when the plus was literal
  • Running decode twice without checking whether a second layer exists
  • Ignoring malformed percent sequences copied from logs or emails

Related problems

FAQ

Why does %2520 become %20?

%25 is an encoded percent sign. One decode turns %2520 into %20; a second decode turns %20 into a space.

Should plus signs decode to spaces?

Only in form-encoded values. Elsewhere, a literal plus may need to stay as plus or be encoded as %2B.

What makes a percent sequence invalid?

A percent sign must be followed by two hexadecimal characters. Anything else can make strict decoding fail.