Why web addresses need encoding
A URL may only contain a limited set of ASCII characters, and several of them have jobs: ? starts the query string, & separates parameters, = joins a name to its value, / separates path segments and # starts a fragment. A value that contains one of these, or a space or a letter such as é, must be percent-encoded so the browser and server read it as data rather than structure.
Percent-encoding, defined in RFC 3986, writes each byte as a % followed by two hexadecimal digits. Text is first converted to UTF-8 bytes, so é becomes two bytes and is written %C3%A9, and an emoji becomes four codes.
What this encoder changes
It keeps only the unreserved characters unchanged: letters A to Z and a to z, digits, hyphen, period, underscore and tilde. Everything else is encoded, including / ? & = and #. That is the safe choice for a single query value or path segment. It is slightly stricter than JavaScript's encodeURIComponent, which leaves ! * ' ( and ) unencoded; encoding them as well is always allowed.
In the example, "name=Zoë & Co / 50% off?" turns the = into %3D, the ë into the two codes %C3%AB, each space into %20, the & into %26, the / into %2F, the % sign itself into %25 and the ? into %3F. Letters and digits stay as they are. If you need to encode a whole address, encode each value separately and then join them, or the slashes and question marks will be encoded too.
Plus signs and spaces
HTML forms send data in the application/x-www-form-urlencoded format, where a space is written as + instead of %20. Turn on the plus option when you are building a query string the way a form would. When decoding, the + as space option is on by default because most encoded strings you meet come from query strings; turn it off for path segments, where + is a literal plus sign.
Decoding stops with a message if a % is not followed by two hexadecimal digits, or if the codes do not spell valid UTF-8, and tells you the character position so you can find the problem in a long string.