URL Encoder / Decoder

Percent-encode a string for safe use in a URL, or decode one back to readable text. Both component-level and full-URI encoding are available, because the difference between them causes real bugs.

Runs entirely in your browser. Nothing you paste is uploaded.

Output
Result will appear here...

About the URL Encoder / Decoder

encodeURIComponent escapes everything that has meaning in a URL, including /, ?, & and =. Use it for individual query parameter values. encodeURI leaves those structural characters intact and is for encoding a complete URL that is already assembled.

Getting this backwards is why a query parameter containing an ampersand silently truncates, or why a full URL passed as a redirect target arrives broken.

Frequently asked questions

encodeURI or encodeURIComponent?

encodeURIComponent for a single value going into a query parameter or path segment. encodeURI for a whole URL you have already built and just need made safe.

Why is a space sometimes %20 and sometimes +?

%20 is standard percent-encoding. The + convention comes from application/x-www-form-urlencoded form submissions and is only valid in a query string, never in a path.

Why did my decode fail?

A stray % that is not followed by two hex digits throws a URIError. That usually means the string was already decoded, or a literal percent sign was never escaped to %25.