Skip to main content
Screendesk
Free tool

URL Decode and Encode

Percent-encode or decode text, choose between encodeURIComponent and encodeURI, and parse any URL into its parts and decoded query parameters.

Open source on GitHub

Text to encode

Component (encodeURIComponent) escapes everything except A–Z a–z 0–9 - _ . ! ~ * ' ( ). Use it for a single query value or path segment.

Encoded

The percent-encoded result appears here as you type.

Runs entirely in your browser. Nothing you paste here is uploaded or stored.

Reference

Which encoding function to use. What each JavaScript function escapes.

JavaScript URL encoding functions compared
FunctionEscapesUse for
encodeURIComponentEverything except A–Z a–z 0–9 - _ . ! ~ * ' ( )A single query value, path segment, or redirect URL passed as a parameter
encodeURISame, but keeps ; , / ? : @ & = + $ #A complete URL that only needs spaces and non-ASCII characters escaped
URLSearchParamsLike encodeURIComponent, but spaces become + and ! ' ( ) ~ are also escapedBuilding form-encoded query strings and POST bodies
Cheat sheet

Common percent-encoded characters. Reserved characters and how they are encoded.

Percent-encoding reference
CharacterEncodedNotes
Space%20+ in form data (application/x-www-form-urlencoded)
!%21Not escaped by encodeURIComponent
#%23Starts the fragment
$%24Reserved sub-delimiter
%%25Escape character itself
&%26Separates query parameters
+%2BMeans space in form data, so encode it in values
,%2CReserved sub-delimiter
/%2FSeparates path segments
:%3ASeparates scheme, port, and credentials
=%3DSeparates a query key from its value
?%3FStarts the query string
@%40Separates credentials from host
é%C3%A9Non-ASCII characters are encoded as UTF-8 bytes
FAQ

Frequently asked questions

What is URL encoding?

URL encoding, or percent-encoding, replaces characters that are not allowed or have special meaning in a URL with a % followed by two hex digits. A space becomes %20, & becomes %26, and non-ASCII characters are encoded as their UTF-8 bytes, so “é” becomes %C3%A9.

Should I use encodeURIComponent or encodeURI?

Use encodeURIComponent for pieces of a URL: a query value, a path segment, or a whole URL you pass as a parameter (like redirect_uri). Use encodeURI only on a complete URL, because it leaves delimiters such as / ? & = # intact. Using encodeURI on a query value is a common bug: an & inside the value will split it into two parameters.

Why is a space sometimes + and sometimes %20?

In the query string of HTML form submissions (application/x-www-form-urlencoded), a space is written as +. Everywhere else in a URL, a space is %20. When decoding form data, turn on “Treat + as space”; otherwise a literal + is kept.

Why does my decoded URL still contain %20 or %2F?

The value was probably encoded twice, for example %2520 instead of %20 (%25 is the encoded % sign). This happens when a framework encodes a value that was already encoded. The tool flags still-encoded output and lets you decode again, but the real fix is to encode exactly once.

What causes “URI malformed” errors?

decodeURIComponent throws when a % is not followed by two hex digits, or when the bytes do not form valid UTF-8, for example a literal “100%” or text encoded as Latin-1 (%E9 for é). This tool shows the position of the first bad sequence.

Customer support runs on Screendesk.

Start for free