Saved

Press the star next to a tool's name to save it.

All my tools

URL Encode / Decode

Paste text to percent-encode it for a URL, or paste an encoded URL to read it. It runs in your browser, so nothing you enter is uploaded.

Your result opens on the next page.

Your text stays on this device. It’s never uploaded or saved.

Paste your text to see the result.

Why URLs need encoding

A URL can only use a limited set of characters, and some have special jobs. For example, & separates values and ? starts the query. To use them as ordinary text, percent-encoding replaces each one with a % and its hex code.

CharacterEncoded
Space%20
&%26
=%3D
?%3F
/%2F
+%2B

A single value or a full URL?

  • Part of a URL: encodes all special characters. Use this for one value going into a query string. Jane & Co becomes Jane%20%26%20Co.
  • Full URL: keeps characters like /, ? and & working so the URL still points to the same place, and encodes the rest, such as spaces.

Don’t encode a full address with the “part” option, or its slashes will stop working.

The plus sign

Web forms often send a space as +. When decoding form data, turn on the plus option so those become spaces. Leave it off for other URLs, where a plus is just a plus.

If decoding fails, the text usually has a stray % that isn’t followed by two hex digits. For other data, try the JSON formatter.

How to use the URL encode decode tool

  1. Pick what you want to do. Choose Encode to make text safe for a web address, or Decode to turn percent codes back into readable text.
  2. Paste into “Your text or URL”. This can be a single value, such as a search term, or a whole address.
  3. When encoding, answer “What are you encoding?” Pick “Part of a URL (a value)” for one value, or “A full URL” for a complete address.
  4. When decoding form data, tick “Treat + as a space”. Leave it off for ordinary links.
  5. Open the result. It opens on the next page, where you can copy it. Switching direction moves the result into the box, so you can check the round trip.

Worked example: one value or the whole query

The box starts with name=Jane Doe&city=New York. Here is what each option gives:

OptionResult
Part of a URL (a value)name%3DJane%20Doe%26city%3DNew%20York
A full URLname=Jane%20Doe&city=New%20York

The part option turns the equals signs and the ampersand into codes, so the whole line becomes one value. That is right if you want to pass this text as a single setting inside another link. The full URL option keeps = and & working, so a server still reads two fields, name and city, and only the spaces change. Decoding either result gives back the text you started with.

A full address works the same way. Encode https://example.com/search?q=café au lait&page=2 with the full URL option and you get https://example.com/search?q=caf%C3%A9%20au%20lait&page=2. The slashes, the question mark and the ampersand still do their jobs, while the spaces and the accented letter are now safe to paste into an email or a document.

Which characters are left alone

RFC 3986 calls letters, digits and the four marks - . _ ~ unreserved, and they never need encoding.[1] The browser functions behind this tool keep a few more characters:

  • Part of a URL leaves A–Z, a–z, 0–9 and - _ . ! ~ * ' ( ) as they are, and encodes everything else.[2]
  • A full URL also leaves ; / ? : @ & = + $ , and # alone, because they give the address its structure.[3]

MDN points out that RFC 3986 reserves ! ' ( ) and * even though they have no set job in a URL.[3]

Accented letters, other scripts and emoji

A character outside basic English becomes several codes. MDN explains that each such character is replaced by one to four escape sequences that spell out its UTF-8 bytes.[2] RFC 3986 says the same for web addresses: turn the characters into UTF-8 first, then percent-encode each byte.[1] So café becomes caf%C3%A9, because é is two bytes in UTF-8.

The tool writes the hex digits in capitals. RFC 3986 treats %c3 and %C3 as the same and says software that makes URLs should use capitals for consistency.[1] Both forms decode here.

Plus signs, spaces and form data

There are two ways to write a space. In a link it is %20. In data sent by a web form, the application/x-www-form-urlencoded format, spaces become a plus sign instead.[2] Browser code that reads query strings, such as URLSearchParams, treats a plus sign as a space.[4] That is why the decoder has a choice. Decode Jane+Doe with “Treat + as a space” ticked and you get Jane Doe. Leave it off and you get Jane+Doe.

The same rule can break values that really contain a plus sign. MDN shows Base64 data losing its plus signs when it is read as query text.[4] Encode such a value with the part option first: a+b=c becomes a%2Bb%3Dc, which survives the trip.

Why decoding fails, and double encoding

A percent sign has to be followed by two hex digits. Decoding the plain text 50% off fails, because % is followed by a space. Encode it first and it becomes 50%25%20off, where %25 is the percent sign itself.

The opposite problem is encoding twice. If %20 is encoded again, its percent sign becomes %25, so a space ends up as %2520. When a page shows %2520 or %253A, decode the text twice to get the original. To split a full address into its scheme, host, path and query, use the URL parser.

What next

Use this often? Add URL Encode / to your Home screen.

Frequently asked questions

What does %20 mean in a URL?

It’s an encoded space. The number 20 is the hex code for the space character.

Should I encode the whole URL?

Use the full URL option for a whole address, so its slashes and question mark keep working. Use the part option for one value inside it.

Why won’t my text decode?

It probably has a % that isn’t followed by two hex digits, or an incomplete character code. Check for a cut-off URL.

Is my text sent anywhere?

No. It all runs in your browser, so what you paste stays on your device.

Should a space be %20 or a plus sign?

Use %20 in links and paths. A plus sign only means a space in form data and query strings read as form data. If you are not sure, %20 is the safer choice.

What does %2520 mean?

It is a space that was encoded twice. The first pass turned the space into %20, and the second turned its percent sign into %25. Decode the text twice to get the space back.

What went wrong?

We only receive the reason you pick, never what you typed into the tool.

Thanks for your feedback.

More Developer Tools