Why URLs Need Encoding
A URL can only contain a limited set of ASCII characters. Everything else — spaces, umlauts, emoji, and characters that have special meaning like &, = and ? — must be percent-encoded: each byte of the character's UTF-8 representation becomes % followed by two hex digits. Skip this step and a search query like coffee & cream silently breaks your query string: the & starts a new parameter and half your value vanishes.
This tool uses encodeURIComponent, the strict variant meant for individual URL parts. coffee & cream becomes coffee%20%26%20cream, and decoding reverses it exactly.
Common Characters and Their Encodings
| Character | Encoded | Why it matters in a URL |
|---|---|---|
| space | %20 | Spaces terminate the URL in many contexts |
& | %26 | Separates query parameters |
= | %3D | Separates parameter name and value |
? | %3F | Starts the query string |
# | %23 | Starts the fragment — everything after is dropped from requests |
/ | %2F | Path segment separator |
+ | %2B | Decoded as a space in form data if left raw |
ü | %C3%BC | Non-ASCII — two bytes in UTF-8, two %-sequences |
encodeURI vs. encodeURIComponent
JavaScript ships two encoders, and mixing them up is a classic bug. encodeURI is for a complete URL: it leaves :, /, ?, # and & alone so the URL structure survives. encodeURIComponent — what this tool uses — is for a single value inside a URL and encodes all of those. Rule of thumb: building a query parameter? Always encodeURIComponent. Encoding a whole URL someone typed? encodeURI. If you encode a full URL with the component variant, the https%3A%2F%2F at the front tells you what went wrong.
Pitfalls Worth Knowing
- Double encoding: encoding twice turns
%20into%2520. If you see%25sequences in the wild, something encoded already-encoded text. - Decoding invalid input: a stray
%not followed by two hex digits (like100% legit) fails to decode — the tool reports it instead of guessing. - + is not always a space: only in
application/x-www-form-urlencodedform data.decodeURIComponentcorrectly leaves+as+.
Everything runs entirely in your browser — no URL you paste is ever sent to a server. Related tools: escape text for markup with the HTML encoder, or build clean URL paths with the slug generator.