URL Encoder
Encode, decode and dissect any URL.
- Local by default
- No signup
- AI is opt-in
URL breakdown
Paste an absolute URL above to inspect its parts and query parameters.
Percent-encoding is simple in principle and error-prone in practice, mostly because there are two different functions with similar names. Encode or decode a value here, inspect the parts of a URL, and see exactly which characters were escaped.
Percent-encoding in one paragraph
A URL may only contain a limited set of ASCII characters. Anything else — spaces, quotes, non-Latin text, and reserved delimiters used as data — must be written as % followed by two hexadecimal digits representing its UTF-8 byte. A space becomes %20, and a euro sign becomes %E2%82%AC because it takes three UTF-8 bytes.
encodeURIComponent versus encodeURI
This is the distinction that causes most broken links. encodeURIComponent escapes everything except unreserved characters, including / ? & = #. It is correct for a single value you are inserting into a query string. encodeURI leaves URL structure characters intact, so it is correct for a complete URL you want to transmit without breaking it.
encodeURIComponent("a b&c") → "a%20b%26c"
encodeURI("https://x.dev/a b?q=1") → "https://x.dev/a%20b?q=1"Using encodeURI on a query value lets & through, which silently splits your value into two parameters. That is the single most common URL encoding bug.
Spaces: + versus %20
HTML form submission encodes spaces as + in the query string, a convention from the original form spec. In a URL path, + is a literal plus. The safe rule: use %20 everywhere except when you are deliberately producing form-encoded bodies, where + is expected. URLSearchParams handles this for you.
Double encoding and how to spot it
If a value gets encoded twice, %20 becomes %2520, because the percent sign itself is escaped. The symptom is a URL that decodes once but still looks wrong. Double encoding usually happens when a framework encodes a value that was already encoded by the caller, or when a redirect re-encodes an existing query string.
Unicode, punycode and the host
Non-ASCII text is percent-encoded as its UTF-8 bytes, not as Unicode code points. é becomes %C3%A9 (two bytes), 中 becomes %E4%B8%AD (three), and an emoji can take four bytes and therefore twelve characters. encodeURIComponent already does this correctly; hand-written %uXXXX escapes are a non-standard JavaScript relic and fail outside old parsers.
Hostnames follow a different rule. Browsers display münchen.de, but DNS resolves the punycode form xn--mnchen-3ya.de. Percent-encoding a host is invalid, so if you accept user-supplied domains, let new URL() or an IDN library convert them instead of encoding the string yourself.
encodeURIComponent("café") → "caf%C3%A9"
new URL("https://münchen.de").hostname → "xn--mnchen-3ya.de" A worked example
Take a search value of a b&c=d/é. The value must be encoded; the URL structure must not. Encoding the value turns every reserved character inside it into data, while the & between parameters stays literal because it is structure.
const value = "a b&c=d/é";
encodeURIComponent(value)
// "a%20b%26c%3Dd%2F%C3%A9"
`https://example.com/search?q=${encodeURIComponent(value)}&page=2`
// https://example.com/search?q=a%20b%26c%3Dd%2F%C3%A9&page=2This is also why the tool shows parsed query parameters next to the encoded string. If a value splits into two parameters after encoding, a delimiter was treated as data in one place and as structure in another.
Anatomy of a URL
- Scheme (
https) — which protocol to speak. - Host (
example.com) — DNS name, optionally with a port. - Path (
/docs/page) — a slash-separated hierarchy, encoded segment by segment. - Query (
?q=hello) — key/value pairs separated by&. Keys and values are encoded independently. - Fragment (
#section) — client-side only; never sent to the server.
The breakdown panel parses whatever URL you paste and shows each part plus every query parameter already decoded, which is the fastest way to find a parameter whose value was encoded with the wrong function.
Frequently asked questions
What is the difference between encodeURI and encodeURIComponent?
encodeURIComponent escapes all reserved characters, including / ? & = #, so it is correct for a single query value. encodeURI preserves URL structure and is correct for a whole URL. Applying the wrong one either breaks the URL structure or leaves delimiters unescaped inside a value.
Why does + turn into a space when I decode?
In form encoding, + represents a space. URLSearchParams and many server frameworks follow that convention, so decoding a literal plus in a query value yields a space. In a path, + stays a plus. Use %2B when you need a literal plus in a query.
Do I need to encode & and = inside a query value?
Yes, if they are part of the value. Unescaped & starts a new parameter and = separates key from value, so a value containing either will be misparsed. encodeURIComponent handles both.
Why does my URL show %2520?
That is double encoding: the percent sign of %20 was itself encoded as %25, producing %2520. Decode the value once before re-encoding, or stop encoding it twice in the pipeline.
Should I encode the whole URL or each parameter?
Encode each parameter value individually, then assemble the URL. Encoding the entire URL with encodeURIComponent destroys the scheme and separators; not encoding values at all leaves reserved characters ambiguous.
How do I encode an internationalized domain name?
Do not percent-encode the host. Convert it to punycode — münchen.de becomes xn--mnchen-3ya.de — by passing the full URL through new URL() or using an IDN library. Percent-encoding belongs in the path, query and fragment, not in the hostname.
Is the fragment sent to the server?
No. Everything after # is handled by the browser and never included in the HTTP request. If a literal # is part of a query value, encode it as %23, otherwise the rest of the value is interpreted as a fragment.