URL Encoder & Parser

[ URL ]
https%3A%2F%2Fjuandesk.com%2Fsearch%3Fq%3D13th%20month%26sort%3Dnew%23top
Encoded — one value
Characters73
Parameters2
[ BOTH ENCODINGS ]
One value — encodeURIComponent
https%3A%2F%2Fjuandesk.com%2Fsearch%3Fq%3D13th%20month%26sort%3Dnew%23top
Whole URL — encodeURI
https://juandesk.com/search?q=13th%20month&sort=new#top
[ THE PARTS ]
Protocolhttps
Hostjuandesk.com
Path/search
Queryq=13th%20month&sort=new
Fragmenttop
[ QUERY PARAMETERS ]
q13th month
sortnew
The two encodings differ for this text, which is exactly when the choice matters. Use the component form for a single value going into a URL; use the whole-URI form only for a URL that is already assembled.
[ WHAT THIS IS ]

The two encoders are not interchangeable, and that is the whole tool.

encodeURIComponent escapes / ? : @ & = + $ # — for one piece going into a URL. encodeURI does not — for a whole URL that is already assembled.

Using the second where the first is needed is the commonest URL bug there is: a value containing & splits into two parameters, and one containing # truncates the URL at the fragment. Both look like a server fault and are not.

And a plus is a space in a query string and nowhere else. A form encodes a space as +; the URL specification uses %20. So a decoder that converts every plus corrupts a genuine one in a path.

[ QUESTIONS ]

Which encoding should I use?

If you are encoding ONE PIECE going into a URL — a query value, a path segment — use the component form, which escapes the reserved characters / ? : @ & = + $ and #. If you are encoding a URL that is already fully assembled, use the whole-URL form, which leaves those alone because they are doing their job. Getting this backwards is the commonest URL bug there is.

What goes wrong if I use the whole-URL form on a value?

The reserved characters survive unescaped and change the meaning of the URL. A value containing & splits into two query parameters. A value containing # truncates the URL at the fragment, so everything after it never reaches the server. Both look like a server fault and are not.

Is + a space or a plus?

It depends where it is. In a query string produced by an HTML form, a space is encoded as +. Everywhere else in a URL a space is %20 and a + is a literal plus. So decoding + as a space corrupts a genuine plus in a path, and not decoding it leaves pluses through a form value. It is a switch on this page, defaulting to off.

Why did my text not decode?

It contains a % that does not begin a valid escape — “100% sure” is the usual culprit. Decoding throws on that, so the text is shown unchanged with a note rather than an error, because you pasted it to see what it is.

Why are repeated query parameters all listed?

Because repeating a key is legal and every framework handles it differently — some keep the first, some the last, some build a list. Collapsing them here would hide a real ambiguity, so all of them are shown and the page says the behaviour depends on what is reading it.

Is it safe to paste a URL with credentials in it?

Nothing you paste leaves your browser, so it is safe from us. It is not safe generally: a password in a URL ends up in server logs, browser history and Referer headers, so a URL that has ever carried one should be treated as exposed. This page masks it rather than displaying it back to you.

[ THE MATHS ]
Both encoders on one text
Input
a&b=c#d
encodeURIComponent — one value
a%26b%3Dc%23d
encodeURI — whole URL
a&b=c#d

The second changed nothing. As a query value that has already split into two parameters and truncated at the fragment.

[ THE PLUS ]
In a form query string+ = space
Anywhere else in a URL+ = plus
[ NEXT ]
58Slug GeneratorMake the path segment in the first place
44Base64 Encoder / DecoderThe other encoding in every URL
72HTTP Status CodesWhat came back from that URL
56HTML Tag RemoverThe other kind of escaping
[ IMPORTANT ]

Runs entirely in your browser; nothing is transmitted. Both encodings are shown because using the whole-URL form where the component form is needed is the commonest URL bug — and it produces a URL that looks correct. Nothing you type here is sent to our servers — the calculation runs entirely in your browser.