When you need URL encoding
URLs can only carry a limited set of characters. Spaces, ampersands, question marks, slashes and anything non-English have to be percent-encoded to survive the trip — otherwise the browser or server reads them as structure rather than content, and your link breaks or silently loses data.
Query value is the one you want most of the time. It escapes everything that has meaning in a URL, including &, =, ? and /, so a value can sit safely inside a query string. Use it when you are building a single parameter.
Whole URL leaves the structural characters alone and only escapes things like spaces, so an address stays a working address. Use it when you have a complete URL that just needs tidying, not one you are assembling.
Form data matches how browsers submit HTML forms: identical to query value except spaces become + instead of %20. Use it when you are matching what a form would send.
Decoding is the reverse. If a decode fails, the input was not valid percent-encoding — usually a stray % that is not followed by two hex digits.
Why a URL breaks without encoding
A URL has structure, and a handful of characters carry that structure: ? starts the query string, & separates parameters, = joins a key to a value, / divides path segments and # begins a fragment. When one of those characters appears inside a value rather than as structure, the parser has no way to tell the difference.
So a search for tools & guides passed raw into a URL becomes ?q=tools & guides, and the server reads a parameter called q holding tools , plus a second parameter called guides with no value. The data is not corrupted — it is silently misread, which is worse, because nothing errors.
Which mode do you need?
Query value is the one to reach for most of the time. It escapes everything with meaning in a URL, including &, =, ? and /, so a value survives intact inside a query string. Use it when you are building a single parameter.
Whole URL leaves the structural characters alone and escapes only the things that were never valid, like spaces. Use it when you have a complete address that needs tidying rather than one you are assembling. Run a whole URL through query-value mode by mistake and you get a single unusable string with every slash escaped.
Form data matches what a browser sends when it submits an HTML form: identical to query value except a space becomes + rather than %20. Both decode to a space; use this mode when you need to match form behaviour exactly.
Reading percent-encoding by eye
Each escaped character becomes a percent sign and two hex digits. A few worth recognising on sight:
%20 — space%2F — forward slash%3F — question mark%26 — ampersand%3D — equals%23 — hash
Anything non-English becomes several bytes: é is %C3%A9, and an emoji can run to four escapes. That is UTF-8, not an error.
When decoding fails
A decode error nearly always means a stray % that is not followed by two valid hex digits — usually a literal percent sign that should itself have been encoded as %25. Percent signs in prices and statistics are the common culprit.
The other frequent trap is double encoding: a string encoded twice, so %20 becomes %2520. Decoding once leaves you with visible %20 in the text. Decode again and it resolves. If you see percent codes in output that should be plain reading, that is what happened.
Base64 solves a related but different problem — making binary data safe to transmit as text. The Base64 encoder covers that, and the two are often confused.