URL Encode and Decode

This tool percent-encodes text so it can travel safely in a web address, and decodes percent-encoded text back. Choose whether you are encoding a single value or a whole address, optionally write spaces as +, and see a clear error if a sequence is broken. Everything runs in your browser and nothing is sent anywhere.

Encode or decode a URL

A single value, such as a search term, also encodes / ? & = #. A whole address keeps them. Strict also encodes ! ' ( ) *.

Encoded result

Everything runs in your browser. Nothing you type is sent anywhere or logged.

How to use it

  1. Pick Encode to make text safe for a web address, or Decode to turn %XX sequences back into readable text. The result appears as you type.
  2. When encoding, choose a single value for anything that goes inside an address, such as a search term or one parameter. Choose a whole web address only to tidy a complete link, because that mode leaves / ? & = # in place.
  3. Tick Write spaces as + if the value is going into an HTML form submission or a query string built the same way. When decoding, leave Read + as a space on for query strings and turn it off for paths.
  4. Tick Show the parts of a web address to list the scheme, host, port, path, each parameter and the fragment of a full link, decoded.

When to use it

  • Putting a search term, an email address or a name with accents into a link or a query parameter.
  • Reading an encoded address from a server log, an analytics report or a redirect.
  • Finding out why an API parameter arrives garbled, cut short or double-encoded.
  • Passing a whole address as a parameter inside another address, such as a return link after sign-in.
  • Checking what each parameter of a long tracking link carries before you click or share it.

How percent-encoding works

A web address may only contain a limited set of characters, and some of those, such as /, ?, & and #, have jobs of their own. To put any other character into an address, it is written as UTF-8 bytes, and each byte becomes a percent sign followed by two hexadecimal digits. RFC 3986 calls this percent-encoding; most people call it URL encoding. Decoding reads every %XX back into a byte and turns the bytes back into text.

Worked example. Take the search term café & tea. The letters c, a and f are safe and stay as they are. The letter é is the Unicode character U+00E9, which UTF-8 stores as the two bytes C3 and A9, so it becomes %C3%A9. A space becomes %20, and the ampersand becomes %26, because a bare & would split the value into two parameters. The result is caf%C3%A9%20%26%20tea, which is what the tool shows when it opens. In form style the spaces become plus signs instead: caf%C3%A9+%26+tea.

Which characters are left alone

RFC 3986 names a small set of unreserved characters that never need encoding: the letters A–Z and a–z, the digits 0–9, and - . _ ~. It also names reserved characters that separate the parts of an address, such as : / ? # @ & = +. The three modes of this tool differ only in what they leave unencoded:

  • A single value keeps the unreserved characters plus ! ' ( ) *, matching JavaScript’s encodeURIComponent. Use it for anything that goes inside an address.
  • A whole web address also keeps ; , / ? : @ & = + $ #, matching encodeURI. It fixes spaces and accented letters in a complete link without breaking its structure.
  • Strict RFC 3986 keeps only the unreserved characters, so ! ' ( ) * are encoded too. Some signing schemes, such as OAuth 1.0, require this form.

Plus signs, spaces and double encoding

HTML forms send their fields as application/x-www-form-urlencoded, which writes a space as + and therefore has to write a real plus sign as %2B. Elsewhere in an address, a plus sign is just a plus sign, so %20 is the safe choice for spaces. The WHATWG URL Standard describes both forms.

Double encoding happens when text that is already encoded is encoded again: the percent sign becomes %25, so %20 turns into %2520. The tool warns when you encode text that already contains %XX sequences, and when a decoded result still contains them.

URL encoding is not encryption

Anyone can decode a percent-encoded address. Encoding only makes text safe to carry, so never rely on it to hide a password, a token or personal details in a link.

Common characters and their percent-encoded form
CharacterEncodedWhy it is encoded
space%20 (or + in forms)Spaces are not allowed in an address
#%23Starts the fragment
%%25Starts every percent-encoded byte
&%26Separates query parameters
+%2BMeans a space in form data
/%2FSeparates path segments
=%3DSeparates a parameter name from its value
?%3FStarts the query
é%C3%A9Not ASCII: two UTF-8 bytes
😀%F0%9F%98%80Emoji: four UTF-8 bytes

Frequently asked questions

What is URL encoding?

It is the percent-encoding defined in RFC 3986. A character that is not allowed in a web address, or that has a special job there, is written as its UTF-8 bytes, each as a percent sign and two hexadecimal digits. A space becomes %20 and é becomes %C3%A9.

Should a space be %20 or +?

Use %20 in general. The plus sign means a space only in form data and query strings built the same way, where a real plus sign must then be written %2B. This tool can write either form and can read + as a space when decoding.

What is the difference between encodeURI and encodeURIComponent?

encodeURIComponent is for one value and encodes the separators / ? & = # as well. encodeURI is for a complete address and leaves those separators alone. Encoding a single value with encodeURI is a common bug, because an & or = inside the value then breaks the link. This tool offers both, as “a single value” and “a whole web address”.

What is double encoding, and how do I fix it?

It happens when encoded text is encoded again, so %20 becomes %2520. Decode once to see %20, then use “Use result as input” and decode again. The tool warns you when a decoded result still contains percent sequences.

Why does the decoder say a sequence is invalid?

A percent sign must be followed by two hexadecimal digits, and the bytes must form valid UTF-8. The error gives the position of the problem. A lone % should be written %25. If the address came from an old system that used a legacy character set, %E9 may mean é there, but in UTF-8 it is incomplete.

Is URL encoding a way to hide information?

No. Encoding is reversible by anyone and needs no key. A link that looks scrambled still shows everything it contains to whoever reads it.

Sources and further reading