jakup

For query values & path parts. Encodes reserved chars (/, ?, &, = …). (encodeURIComponent)

Component mode encodes all reserved characters (best for query values); Full URL mode preserves : / ? # & = (best for whole addresses). Spaces become %20 by default, or + with the form option.

Why URLs need encoding

A URL may only contain letters, digits and a few symbols. Spaces, non-Latin characters and symbols such as & ? = break the address or change its meaning if used directly. URL encoding rewrites those characters as a percent sign followed by hexadecimal digits.

A space becomes %20 and an ampersand becomes %26; a non-Latin character usually becomes several %XX groups under UTF-8. It matters when you share a link containing a search term, put a value into a query string, or a link breaks in a messenger app.

You can also go the other way and turn a percent-heavy address back into readable text — handy when checking which search term brought someone to your site. Values are converted only in your browser and never sent to a server.