URL Encoder & Decoder

Percent-encode URLs, with separate modes for full URLs and parameter values

Runs in your browserUtility03Encoding & Crypto

What is URL Encoder & Decoder?

A URL encoder that converts strings to percent-encoding and distinguishes two very different jobs: encoding a whole URL, which preserves structural characters such as : / ? and &, versus encoding a single query parameter value, which escapes those characters too. Both modes run in the browser.

How to use URL Encoder & Decoder

  1. 1Paste the URL or parameter value you need to process.
  2. 2Choose a mode: whole-URL encoding (encodeURI) or component encoding (encodeURIComponent).
  3. 3Switch to the decode direction to reverse percent-encoding.
  4. 4If %25 shows up in the output, the input was already encoded once — watch out for double encoding.

How do I do this in code?

Use the tool above for one-off work; for anything you repeat, move it into a script or your project.

// Whole URL: keeps structural characters such as : / ? & = #
encodeURI('https://a.com/搜索?q=你好');

// A single value: escapes & and = as well
encodeURIComponent('a&b=c');

Common errors and how to fix them

SymptomCauseFix
An & inside a value splits one parameter into twoThe value was encoded with encodeURI, which leaves & untouched.Always encode parameter values with encodeURIComponent.
Decoded output still contains leftovers like %2520The input was encoded twice (double encoding).Decode twice, then find and remove the duplicate call to the encoding function in your code.

Frequently asked questions

When should I use encodeURI instead of encodeURIComponent?+

Use encodeURI when you are encoding a complete URL, since it preserves the structural characters : / ? & = and #. Use encodeURIComponent when you are inserting a value into a query parameter or a path segment, because it escapes those characters too and stops an & inside the value from breaking the parameter structure.

Should a space be encoded as %20 or +?+

Use %20 in URL paths and query strings — that is the standard. The + form belongs to application/x-www-form-urlencoded form submissions. The two are not interchangeable: drop a form-style + into a path and it is read as a literal plus sign.

Related tools

All tools