Skip to content

Developer tools

URL Encoder and Decoder

Percent-encode and decode URLs in your browser. Choose component, whole-URL or form encoding, so a query value is never broken by an unescaped ampersand.

One query value or path segment. Escapes & = ? # / so the value cannot break the URL around it.

empty

About the url encoder

Percent-encoding replaces characters that have a structural meaning in a URL with a % and their hexadecimal byte value, so a value cannot be mistaken for the URL around it. The whole difficulty is that there are three different rules for doing it and using the wrong one is silent — the URL still looks plausible, it just does the wrong thing.

Component encoding is for a single query value or path segment. It escapes &, =, ?, # and / so that a value containing them cannot terminate itself. This is the one people usually want, and forgetting it is how a search for "tea & coffee" arrives at your server as a search for "tea" with a mysterious extra parameter.

Whole-URL encoding leaves the structural characters alone so the URL keeps working, and only escapes things that are never legal, such as spaces. Use it when you are fixing up a link somebody pasted, not when you are inserting a value. Applying component encoding to a whole URL turns https:// into https%3A%2F%2F, which is the same mistake in the opposite direction.

Form encoding is the odd one. In application/x-www-form-urlencoded — what a normal HTML form submits — a space becomes + rather than %20. Decode such a value with the standard decoder and the plus signs survive into your data, which is how "John Smith" ends up stored as "John+Smith". The tool handles it as a separate mode because it genuinely is one.

Decoding reports malformed input rather than throwing. A stray % that is not followed by two hex digits is the usual cause, and it normally means the string was encoded twice, or truncated somewhere along the way.

Frequently asked questions

Was this tool helpful?