Skip to content
TrySitePrice

URL encoder and decoder

Four encodings, side by side, with the exact characters each one leaves alone — because the difference between them is precisely the thing that breaks a URL. All of it runs in your tab; nothing is sent anywhere.

For one value going inside a URL — a query parameter, a path segment. Escapes the URL syntax characters too.

Everything here happens in your browser. Nothing is sent to a server.

Result

—

0 characters in, 0 out.

What each function leaves alone

encodeURIComponent

Not escaped: A–Z a–z 0–9 - _ . ! ~ * ' ( )

MDN lists exactly these as not escaped.

encodeURI

Not escaped: the above plus ; / ? : @ & = + $ , #

MDN: encodeURIComponent “encodes more characters, including those that are part of the URI syntax.”

Strict RFC 3986

Not escaped: A–Z a–z 0–9 - _ . ~

The five extras encodeURIComponent spares are escaped here, following MDN's own encodeRFC3986URIComponent recipe.

The choice matters in one direction more than the other. Running a whole URL through encodeURIComponent breaks it, because the slashes and the question mark become percent sequences. Running one query value through encodeURI leaves an ampersand inside it intact, which silently splits your parameter in two.

Questions about URL encoding

01Which one should I use?

encodeURIComponent for a single value going inside a URL — a query parameter, a path segment. encodeURI for a whole URL you want to stay usable. The mistake that bites is using encodeURI on one value: an ampersand inside it survives and silently splits your parameter in two.

02What does encodeURIComponent leave alone?

A to Z, a to z, 0 to 9, and the characters - _ . ! ~ * ' ( ). MDN lists exactly those, which is why the strict RFC 3986 mode exists: five of them are reserved by that RFC, so it escapes them as uppercase hex.

03Why does form encoding turn a space into a plus?

Because that is what a browser sends for application/x-www-form-urlencoded. It is correct for form data and wrong everywhere else — a plus in a path or a query value usually means a literal plus, which is why decoding has a separate switch for it.

04What is the round-trip check for?

To catch the case where an encoding is not reversible. If the result does not decode back to exactly what you typed, something was lost, and that is better to find here than in a request log.

05Does any of this reach a server?

No. Everything happens in your tab. Nothing you paste is sent anywhere, which matters because people paste tokens and signed URLs into tools like this.

Related tools