FA Dev Tools

URL Encode / Decode

Percent-encode text so it is safe inside a URL query string or path segment (encodeURIComponent), or decode percent-encoded text back to plain text.

Instructions

Converts between plain text and its percent-encoded (URL-safe) form.

  1. Paste or type the text into Input.
  2. Pick Encode to make text safe for a URL, or Decode to turn %20-style escapes back into characters.
  3. The result appears in Output as you type — use Copy to take it.

Tips

  • Encoding uses encodeURIComponent, so /, ?, & and = are escaped too. That is what you want for a single query value, not for a whole URL.
  • A + in a query string means a space in form-encoded data but a literal plus here — decode it as %2B if you need the character.
  • Not sure where to start? Hit Example and pick a direction — the input and output fill in for you.

About URL encoding

What URL encoding is for

A URL may only contain a small set of ASCII characters, and several of them have a job. ? starts the query string, & separates parameters, = splits a name from its value, # starts the fragment and / separates path segments. When one of these is part of your data, for example a search for tom & jerry, it has to be escaped, or the server will read it as structure.

The escape is called percent-encoding and is defined in RFC 3986. Each byte is written as % followed by two hex digits: a space becomes %20 and & becomes %26. Text outside ASCII is first turned into UTF-8 bytes, so é becomes %C3%A9 and 中 becomes %E4%B8%AD.

Encode a value, not the whole URL

This tool encodes with the browser function encodeURIComponent. It escapes everything except the letters A–Z and a–z, the digits, and - _ . ! ~ * ' ( ). That is right for one query value or one path segment. It is wrong for a whole URL, because https:// turns into https%3A%2F%2F and the link stops working.

JavaScript also has encodeURI, which keeps : / ? # & = + $ , ; @ intact so a complete URL survives. The catch is that it cannot protect a value that itself contains & or =. The safe pattern is to encode each name and value on its own, then join them with = and &.

The plus sign and other gotchas

HTML forms and URLSearchParams use a related format, application/x-www-form-urlencoded, where a space is written as +. This decoder follows RFC 3986 and keeps + as a plus sign, so if your text came from a form submission, replace + with a space first. When encoding, the tool writes spaces as %20, which every server accepts.

Some signing schemes, such as OAuth 1.0 and AWS Signature Version 4, require ! ' ( ) * to be encoded as well. Since encodeURIComponent leaves them as they are, replace them with %21, %27, %28, %29 and %2A in those cases. If you see %25 in a URL, the text was probably encoded twice: %20 encoded again becomes %2520. Decode it twice to get back to the original.

How this tool handles bad input

Decoding uses decodeURIComponent, which turns every escape back into its character, including %2F into /. If the input has a broken sequence, such as a % not followed by two hex digits (100%) or bytes that are not valid UTF-8 (%E9 from an old Latin-1 page), the browser refuses to decode it and the tool shows your input unchanged instead of a half-decoded result. Everything runs in your browser. To split a long link into its parameters and decode each one, use the Query String tool.

Frequently asked questions

Should a space be %20 or + in a URL?
Both are common. %20 is correct anywhere in a URL. + means a space only in form-encoded query strings, and in a path it is a literal plus sign. When in doubt, use %20.
Why does my URL contain %2520?
It was encoded twice. The first pass turned a space into %20, and the second pass encoded the % sign as %25. Encode each value exactly once, just before you put it into the URL.
Do I need to encode the whole URL?
No. Encode only the parts that hold your data, usually each query value and sometimes a path segment. Encoding the whole URL also escapes the colon and slashes that make it a link.