How it works
Web addresses can only contain some characters. Spaces, accents and symbols such as & and = are written as a percent sign followed by two hex digits, so a space becomes %20.
“A piece of a URL” encodes everything unsafe, including / ? & and =. Use it for a single value, such as a search term in a query string.
“A whole URL” keeps the characters that give a URL its structure (: / ? & = #) and only encodes the rest. Use it when you have a full address with spaces or accents.
When decoding a piece, a plus sign is read as a space, as in form data.
Good to know
Non-English text is encoded as UTF-8 bytes, so “é” becomes %C3%A9.
Double encoding is a common bug. If you see %2520, the text was encoded twice.
Frequently asked questions
Which option should I choose?
For a value you will put into a link, use “a piece of a URL”. For a complete link that has a space in it, use “a whole URL”.
Why does decoding fail?
A % must be followed by two hex digits. Text with a stray % or a cut-off sequence cannot be decoded.
Is my text sent anywhere?
No. Everything is done in your browser.