URL Encode / Decode

About this calculator

The URL Encode / Decode tool converts text into the percent-encoded form that is safe inside a URL, or turns %XX sequences back into readable characters. Encoding escapes every character that has a special meaning in a URL, so the result is safe as a query value or path segment. Decoding turns an encoded link back into plain text.

Replace the example with your own text.
Action
Embed this calculator

Paste this code into a Custom HTML block on your site. The calculator fits the width of the block. Adjust the height in the code if you want more room for results.

Find this widget in the publisher directory

What URL encoding is

A URL can only contain a limited set of characters. Letters, digits and a few symbols are safe everywhere, while spaces, accented letters and characters such as &, = and ? either have a special job in the URL or are not allowed at all. Percent-encoding, also called URL encoding, replaces each unsafe byte with a percent sign followed by two hexadecimal digits. A space becomes %20, a slash becomes %2F and the percent sign itself becomes %25.

How non-ASCII text is encoded

Text is first converted to UTF-8 bytes, and each byte is then percent-encoded. The letter é is two bytes, C3 and A9, so it becomes %C3%A9. The euro sign is three bytes and becomes %E2%82%AC. Decoding reverses the steps, joining the bytes back into characters.

Component versus full URL

ModeLeaves aloneUse it for
ComponentA-Z a-z 0-9 - _ . ! ~ * ' ( )A single query value, path segment or form field
Full URLThe above plus ; , / ? : @ & = + $ #A complete address whose structure must stay intact

The difference matters. If you encode a whole URL as a component, the slashes and question mark are escaped and the link breaks. If you encode a query value in full URL mode instead, an ampersand inside the value is left alone and is read as a separator. This tool uses component mode, the safe choice for values.

Worked example

Encoding the value name=Zoë & co/100% as a component gives name%3DZo%C3%AB%20%26%20co%2F100%25. Likewise a b&c=d/é becomes a%20b%26c%3Dd%2F%C3%A9. This tool always encodes in component mode, so to keep a whole address working, encode only the parts that hold data, such as each query value, and leave the scheme, slashes, question mark, ampersands and hash as they are.

Reserved and unreserved characters

RFC 3986 calls letters, digits, hyphen, period, underscore and tilde unreserved: they never need encoding. The reserved characters  : / ? # [ ] @ ! $ & ' ( ) * + , ; = have special meaning and must be encoded when they appear as data rather than as syntax. The standard JavaScript functions are slightly more relaxed than the RFC and leave a few extra characters, such as ! * ' ( ), unescaped in component mode.

Plus signs and spaces

Within the query string of an HTML form submission, spaces are traditionally written as +. Percent-encoding proper uses %20. This tool keeps plus signs as they are when decoding, since a literal plus is common in phone numbers and time zone offsets. To decode form data, replace each + with a space first.

Common problems

  • Double encoding: encoding text that is already encoded turns %20 into %2520. Decode first if you see this.
  • Malformed sequences: a stray percent sign not followed by two hex digits cannot be decoded.
  • Wrong charset: old systems may use Latin-1 instead of UTF-8, which produces different byte sequences for accented letters.

Everything on this page runs in your browser. Your text is never uploaded.

Where you will meet encoded URLs

Percent-encoding shows up in query strings from search engines and forms, in redirect addresses that carry another URL as a parameter, in file names with spaces or accents, and in links shared by email and chat. When a link looks like a wall of percent signs, decoding it reveals the real text. When you build a link by hand, such as a mailto link with a subject line or a redirect to a login page, encode each value as a component first and then join them with the real ampersands and equals signs.

Characters worth remembering

CharacterEncoded
Space%20
&%26
=%3D
?%3F
#%23
/%2F
%%25

Frequently asked questions

What is the difference between encodeURI and encodeURIComponent?
encodeURI keeps characters that structure a URL, such as / ? & = and #. encodeURIComponent encodes them too, so it is the right choice for a single value inside a query string.
Why does a space become %20?
A space has the byte value 20 in hexadecimal, and percent-encoding writes each unsafe byte as a percent sign and its two-digit hex value.
How do I decode a URL?
Paste the encoded text and choose Decode. Each %XX sequence is turned into its byte and the bytes are read as UTF-8.
Why do I see %2520?
That is double encoding. %25 is an encoded percent sign, so %2520 is an encoded %20. Decode twice to get a space.

Formulas and sample results on this page were checked against independent references. Page last reviewed or updated . How we verify calculators. Project led by Shaun Connell.