%url-decoder.net

How Servers Decode URLs: Path, Query and Double Decoding

Updated November 18, 2026 · 6 min read

Short answer

In an HTTP request the URL travels percent-encoded. The server splits the request target into path and query first, then decodes each part: the path with plain percent-decoding, the query usually with form rules where + is a space. The fragment after # is never sent. Decoding a value more than once is a classic security bug.

When you type an address or click a link, the URL is percent-encoded before it leaves the browser, and it is decoded again on the server. Most of the time this is invisible. When it is not, the symptoms are files that cannot be found, plus signs that turn into spaces, and security filters that can be bypassed. This guide follows a URL through one request.

What the browser sends

Take this address:

https://example.com/files/Q3%20report.pdf?q=caf%C3%A9+au+lait&tag=a%26b#page=2

The browser connects to the host and sends a request line containing only the path and the query, still encoded:

GET /files/Q3%20report.pdf?q=caf%C3%A9+au+lait&tag=a%26b HTTP/1.1
Host: example.com

The fragment, #page=2, is not sent. It stays in the browser for scrolling and for client-side code.

How the server decodes it

A server or framework must split the target into its parts before decoding, because decoding first would turn an encoded %3F into a real ? and move the boundary between path and query. Then it decodes each part:

  • Path: plain percent-decoding. /files/Q3%20report.pdf becomes /files/Q3 report.pdf. A + in a path stays a plus.
  • Query: most frameworks parse it with the form rules from the WHATWG URL Standard, where + means a space. Parsed that way, this query gives:
    • q = café au lait
    • tag = a&b
    The %26 inside tag stays part of the value because the query was split on & before decoding.

Decode once, at the right time

RFC 3986 says implementations must not percent-encode or decode the same string more than once. Decoding twice is not just a correctness bug. OWASP describes double encoding as a way past security filters: a path such as %252E%252E%252F looks harmless after one decode (%2E%2E%2F), but becomes ../ if a later layer decodes it again (OWASP: Double Encoding). Validate input after the final decode, and decode in exactly one place.

When things go wrong

  • 404 for a file with a space or plus in its name. The link was not encoded, or was encoded with form rules (+) for a path. Paths need %20; see %20.
  • 404 for a path containing %2F. Several servers reject encoded slashes in paths by default; see %2F.
  • A + in a query value becomes a space. Form-style parsing at work; encode a literal plus as %2B.
  • 414 URI Too Long. The URL exceeded a server limit. RFC 9110 recommends supporting at least 8000 octets, but proxies and servers set their own limits; move large data into the request body.

Questions

Does the browser send the part after # to the server?

No. The fragment is used only by the browser. It is not part of the HTTP request target, so the server never sees it.

Why does the server see %20 instead of a space?

A space is not allowed in an HTTP request line, so clients send it encoded as %20. Frameworks normally decode it before your code reads the path or query values.

Is it safe to decode a URL twice?

No. RFC 3986 says the same string must not be decoded more than once. Decoding twice turns %2520 into a space and lets encoded payloads slip past filters that only checked the first decoded form.

How long can a URL be?

RFC 9110 recommends that senders and recipients support URIs of at least 8000 octets. Real limits depend on the browser, server and any proxy in between, so keep large data in the request body.

See also

Try everything in this guide hands-on, free and entirely in your browser.

Decode a URL in the URL Decoder

Keep reading