thoughtasylumTOOLBOX Preview

Tools › Encoding

URL Encode/Decode

Percent-encode or decode at either of JavaScript's two levels. Typical (encodeURI) keeps a URL's structure (: / ? # & = and so on) and suits a whole URL; Aggressive (encodeURIComponent) encodes all but letters, digits and - _ . ! ~ * ' ( ), and suits one query value or path segment.

About this tool What it's for, how to use it and an example

What it's for

Percent-encode text so it’s safe to put in a URL, or decode a URL full of %20s back into something readable.

For example, when you’re building a link with a search term in it, encode the term so spaces and & don’t break the URL, or decode a long tracking link to see where it really goes.

How to use it

Paste text or an encoded URL, pick a level, and choose Encode or Decode.

  • Typical keeps a URL’s structure (:, /, ?, #, &, =) and suits a whole URL.
  • Aggressive encodes everything except letters, digits and - _ . ! ~ * ' ( ), and suits a single value going into a query string or path.

Tick read + as a space when decoding data from an HTML form, where spaces are sent as +.

Example

Paste fish & chips, choose Aggressive and Encode. The result is:

fish%20%26%20chips

With Typical, https://example.com/search?q=fish & chips becomes https://example.com/search?q=fish%20&%20chips: the space is encoded, but the & is kept, which would break the query. That’s why a single value needs Aggressive.

Good to know

Decoding fails if a % isn’t followed by a valid encoded character, and the tool tells you rather than guessing. The two levels match JavaScript’s encodeURI and encodeURIComponent exactly.

Private: this tool runs in your browser. Nothing you type, paste or choose leaves this page.

Saved you a few minutes? Say thanks with a coffee.

Something wrong with this tool, or missing from it? Report a bug or suggest a feature.

↑ ↓ move↵ openesc close