URL Encoder & Parser

Files & data

Encode, decode and take a URL apart. Both encoders shown.

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.

How to use

What it's for

Make a word or phrase safe to put inside a web link, turn a link full of codes like %20 back into readable text, or see a long web address split into its parts.

Before you start

Have the link or the piece of text to hand — copied from the browser's address bar, an email or a form. Nothing you paste leaves your browser.

  1. Paste the address or the text

    Paste it into URL or value, replacing the sample. It can be a whole web address or just one word or phrase.

  2. Choose what to show

    In Show, pick Encoded — one value for a single piece that goes inside a link, such as a search word or a name; this is the safe choice. Pick Encoded — whole URL only for a complete address whose spaces or accented letters need making safe. Pick Decoded to turn %20 and similar codes back into readable text.

  3. Treat + as a space, if it came from a form

    Tick Decode + as a space when the text came from a web form or a search box, where a space is written as +. Leave it off otherwise, because everywhere else + really means plus.

  4. Convert and copy

    Press Convert to bring the answer into view — it also updates as you type. Press Copy at the top to take it.

Reading the result

  • URL: the result in the form you chose under Show, with that form's name under it.
  • Both encodings: the one-value and whole-URL versions together, so you can see whether they differ for your text.
  • The parts: for a whole web address, its pieces — such as the Host (the site's name), the Path (the page) and the Query (everything after the ?).
  • Query parameters: each name and value from the query, decoded so you can read it.

If it goes wrong

  • A link broke after you put a value in it: you probably used Encoded — whole URL on the value. It leaves & and # alone, and they cut the link short, so use Encoded — one value.
  • The text came back unchanged with a note saying it could not be percent-decoded: it has a % that does not start a code, as in "100% sure". The text is shown as it is so you can see what is there.
  • Pluses stayed as pluses: tick Decode + as a space if the text came from a form.

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

Keep going

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.