URL Encoder/Decoder

Percent-encode or decode a URL or query string.

Mode

Encode text for safe use in a URL, or decode a percent-encoded URL back to readable text, with both component and full-URI encoding modes.

Common encoded characters

CharacterEncoded
space%20
&%26
=%3D
?%3F
/%2F
#%23
+%2B
é%C3%A9 (two UTF-8 bytes)

Letters, digits and the characters - _ . ~ are never encoded.

Example

To search for salt & pepper, the query value must be encoded so the & isn't read as the start of a new parameter:

https://example.com/search?q=salt%20%26%20pepper

Which mode should I use?

  • Component — for a single piece of a URL, like one query value or path segment. It encodes everything with special meaning, including & = ? /. This is the right choice almost every time.
  • Full URI — for a complete URL that only needs spaces or non-English characters fixed. It leaves the URL's structure (: / ? # & =) intact.

Why %20 and sometimes +?

In HTML form submissions, spaces are often sent as + instead of %20. Both mean a space inside a query string, but only %20 works everywhere in a URL. If you decode text and see plus signs where spaces should be, it probably came from a form.

Frequently asked questions

When do I need to URL-encode text?

When putting text with special characters (spaces, &, =, ?, /, non-Latin characters) into a URL query string or path, so it's transmitted correctly.

What's the difference between the two encode modes?

Component encoding (encodeURIComponent) escapes everything meant for a single query parameter, including & and =. Full-URI encoding (encodeURI) leaves URL-structural characters like :, /, and ? alone, since it's meant for encoding a whole URL, not a piece of one.

Why do I see %2520 in a URL?

It means the text was encoded twice — %20 was encoded again, turning the % into %25. Decode it twice to get the original text, and fix the code that encodes it a second time.