URL Encode and Decode

Percent-encode text so it survives inside a URL, or decode an unreadable URL back into plain text.

Why URLs need encoding at all

A URL has structure, and a handful of characters carry that structure: ? starts the query string, & separates parameters, = joins a name to its value, # begins the fragment, / divides path segments. When one of those characters appears inside a value, it has to be disguised — otherwise the parser reads it as structure and your URL means something you did not intend.

Percent-encoding does the disguising: each byte becomes % followed by two hexadecimal digits. A space becomes %20, an ampersand becomes %26, and the accented è becomes %C3%A8 — two bytes, because it is UTF-8.

Component mode versus full-URL mode

This distinction causes more bugs than any other part of URL handling, and the rule is simple once stated.

Component mode (the default) encodes everything that is not strictly safe, including /, ?, & and =. Use it for a piece of a URL: one query parameter value, one path segment. This is the mode you want when inserting user input into a URL.

Full-URL mode leaves the structural characters alone and only encodes things that could never be structure, such as spaces and accented letters. Use it when you have a complete URL that merely needs tidying — encoding it in component mode would destroy it, turning every / into %2F.

Rule of thumb: if you are encoding part of a URL, use component mode. If you are encoding a whole URL, switch component mode off.

The plus-sign ambiguity

In query strings, a + traditionally means a space — a legacy of HTML form submission. In a path segment it means a literal plus. That ambiguity is why an email address like user+tag@example.com sometimes arrives with the tag turned into a space. When decoding, this tool treats + as a space, matching query-string behaviour; if you need a literal plus in a value, encode it as %2B.

Where it shows up

  • Building a search URL that contains spaces, quotes or non-English characters.
  • Reading an OAuth redirect URL to see what the redirect_uri and state actually contain.
  • Debugging analytics campaign links where a stray unencoded & has truncated the parameters.
  • Putting a full URL inside another URL as a parameter, which requires encoding it as a component.

Frequently asked questions

What is the difference between the two modes?

Component mode encodes the URL's structural characters (/, ?, &, =) and is for encoding a single parameter value or path segment. Full-URL mode leaves them intact and is for tidying a complete URL.

Why does a space sometimes become + and sometimes %20?

Both are valid in a query string. + comes from HTML form encoding, %20 from the URL standard. In a path segment only %20 is correct. This tool produces %20 and accepts either when decoding.

Why did my email address lose its plus sign?

Because a decoder read the + as a space, which is the query-string convention. To keep a literal plus in a value, encode it as %2B before putting it in a URL.

Why is one accented letter turning into six characters?

Each character is encoded as its UTF-8 bytes, and accented letters take two bytes, so è becomes %C3%A8. Characters outside the Latin range can take three or four bytes. This is correct and decodes back cleanly.