Skip to content

URL Encoder / Decoder

Encode and decode URLs and query parameters with encodeURI and encodeURIComponent behavior, UTF-8 and clear errors. Runs in your browser: nothing is uploaded.

Direction

Processed locally in your browser. Your data never leaves your device.

About this URL encoder and decoder

URLs can only contain a limited set of characters. Everything else, including spaces, accented letters, emoji and characters that have special meaning in a URL, has to be replaced by percent-encoding: a percent sign followed by the two hexadecimal digits of each UTF-8 byte. This tool converts in both directions and tells you exactly where an input is malformed.

How to use it

  1. Choose Encode or Decode.
  2. Say what your input is: a single value (encodeURIComponent) or a whole URL (encodeURI).
  3. Type or paste. The result updates after a short pause. Use Swap to convert the result back.

Value or whole URL?

For a query parameter value, encode as a value. a&b=c becomes a%26b%3Dc, so the ampersand and equals sign cannot break the query string. For a complete URL, encode as a whole URL, which keeps : / ? # & = intact and encodes only what is not allowed: https://example.com/a b?q=é becomes https://example.com/a%20b?q=%C3%A9.

Example

The text name=Ada & Grace/100% encoded as a value is name%3DAda%20%26%20Grace%2F100%25. The last two characters, %25, are the encoded percent sign.

Common pitfalls

  • Encoding twice. A percent sign inside already-encoded text becomes %25, so %20 turns into %2520. Encode exactly once, at the point where you build the URL.
  • A literal % in decoding. Text such as 100% sure is not valid percent-encoding. The decoder points at the offending percent sign.
  • Plus versus %20. Only form data treats + as a space.
  • Strict RFC 3986. JavaScript leaves ! ' ( ) * unencoded. Some servers and signature schemes require them encoded; turn on the strict option for those.
  • Legacy encodings. Old systems encode text as Latin-1 (%E9) instead of UTF-8 (%C3%A9). These do not decode as UTF-8 and are reported as such.

Frequently asked questions

What is the difference between encodeURI and encodeURIComponent?
encodeURIComponent encodes everything except letters, digits and - _ . ! ~ * ' ( ), so it is right for a single value such as a query parameter. encodeURI leaves the characters that give a URL its structure (: / ? # & = and so on) alone, so it is right for a whole URL. Using encodeURI on a value, or encodeURIComponent on a whole URL, are the two classic mistakes.
Why is a space sometimes %20 and sometimes +?
%20 is the standard percent-encoding of a space. A plus sign means a space only in form data (application/x-www-form-urlencoded, what HTML forms submit). Use the form data option when decoding a query string produced by a form.
Why do I get "not valid UTF-8" or "invalid escape" when decoding?
A % must be followed by two hexadecimal digits, so a literal percent sign has to be written as %25. And a run of escapes must form valid UTF-8: %E9 on its own is Latin-1 (é), while UTF-8 uses %C3%A9. The error shows the exact position.
My result still contains %20 or %25. What happened?
The text was encoded twice (for example a URL was encoded and then placed inside another encoded URL). Decode it again to unwrap the second layer. The tool points this out.
Is my data sent to a server?
No. Everything runs in your browser. Nothing you type or paste is uploaded, stored or logged.