🔗

URL Encoder / Decoder

Encode and decode URLs and query string parameters. Handles full URLs and individual components, with whole-string encoding when you need it.

✓ Free forever✓ No signup✓ 100% private — runs in your browser
URL Encoder / Decoder
Encode or decode URL components. Supports encodeURI, encodeURIComponent, and full percent-encoding.
Input
Output
Result appears here…
Parse URL Parameters

URLs may only contain a limited set of ASCII characters. Anything else — spaces, accented letters, ampersands inside a value, emoji — has to be percent-encoded, where each byte becomes a % followed by two hex digits. Getting this wrong is a common source of broken links and mangled parameters.

How to use the URL Encoder / Decoder

  1. Paste the URL or parameter value
  2. Choose Component Encode for a single value, or full encoding for a complete URL
  3. Use Decode to turn percent-escapes back into readable text
  4. Copy the result

Encode the component, not the whole URL

This is the distinction that causes most bugs. There are two encoding functions and they treat reserved characters differently.

Component encoding escapes everything that is not unreserved, including / ? : @ & = +. Use it for individual parameter values. A search term containing an ampersand must be component-encoded, or the & will be read as a parameter separator and silently truncate the value.

Full-URL encoding leaves those reserved characters alone, because in a complete URL they are structural — the slashes separate path segments, the question mark starts the query. Use it when escaping an entire URL that is otherwise already well-formed.

Encoding a whole URL with component encoding produces a mangled string where https:// has become https%3A%2F%2F.

Characters worth knowing

  • %20 — space. In query strings + also means space, a historical quirk of form submission.
  • %2F — forward slash.
  • %3F — question mark.
  • %26 — ampersand.
  • %23 — hash. Unencoded, everything after it is treated as a fragment and never sent to the server.

Non-ASCII characters are encoded as their UTF-8 bytes, so a single accented letter becomes two percent-escapes and most emoji become four.

The three encoding functions and when each applies

JavaScript exposes three escaping functions and choosing wrongly is the cause of most URL bugs.

encodeURIComponent() escapes everything that is not unreserved, including /, ?, &, = and #. This is what you want for a single value going into a query parameter or a path segment. It is the correct default.

encodeURI() leaves the structural characters alone because it expects a whole URL. Use it only when escaping a complete URL that is already assembled — and never on a value, because a value containing & will survive and split your query string.

escape() is deprecated and does not handle non-ASCII correctly. It should not appear in new code.

The practical rule: encode the parts, then join them. Build ?q= + encodeURIComponent(value). Assembling the string first and escaping afterwards is what produces URLs that work until someone searches for a term containing an ampersand.

Double encoding, and how to recognise it

Double encoding is the most common URL bug after choosing the wrong function, and it has an unmistakable signature: %2520 in the URL.

It happens because % is itself a character that needs escaping. A space encodes to %20; encode that result again and the % becomes %25, giving %2520. Decoded once, the user sees a literal %20 in their search box instead of a space.

The usual cause is a value being encoded in two layers of code — a helper function escapes it, and then the framework escapes the result when building the URL. Each layer is correct in isolation.

To diagnose: look for %25 followed by two hex digits. To fix, find which layer should own the encoding and remove it from the other. Encoding should happen exactly once, as late as possible, at the point where the URL is actually assembled.

The inverse error exists too. Decoding twice turns a literal %20 that was meant as text into a space, which matters when the value is a filename or an identifier that legitimately contains a percent sign.

Frequently asked questions

What is the difference between the encode modes?

Component encoding escapes reserved characters like / ? & = — use it for parameter values. Full-URL encoding preserves them because they are structural — use it on complete URLs.

Why does my query parameter get cut off?

The value almost certainly contains an unencoded & or #, which the server reads as structure rather than data. Component-encode the value.

Is %20 the same as +?

In the query string, both decode to a space. In the path, only %20 does — a literal + in a path is a plus sign. Use %20 when unsure.

Do I need to encode non-English characters?

Browsers display them natively and encode behind the scenes, but anything constructing URLs programmatically should encode explicitly. Each character becomes its UTF-8 bytes as percent-escapes.