URL Encoder & Decoder Online

A URL can only safely contain a limited set of characters: letters, numbers and a few symbols such as the hyphen, the underscore and the dot. Everything else, from spaces and question marks to accented letters and emoji, has to be percent-encoded before it can travel inside a URL. Percent-encoding replaces each unsafe byte with a percent sign followed by two hexadecimal digits, so a space becomes %20, an ampersand becomes %26, and a question mark becomes %3F. Without it, a link breaks: a space in a URL is cut off by many programs, and an ampersand inside a value is read as the start of a new parameter. This free URL encoder and decoder handles both directions, entirely in your browser, so the links and text you paste are never uploaded or stored. The trickiest part of URL encoding is knowing what to encode. A full URL, such as https://example.com/a b?x=1&y=2, should keep its structure: the colon, the slashes, the question mark and the ampersands are part of the URL itself and must stay as they are, while only the space needs encoding.

A single value that you want to put inside a URL, on the other hand, should be encoded completely, including its slashes and question marks, so that it is treated as one value and not as extra structure. This tool offers both options, labelled clearly, so you can encode a whole link or just one component depending on what you are doing.

URL Result

Enter a URL above and choose an action.

Advertisement space — AdSense ads will appear here after approval.

Encode a Component or a Full URL?

Use encodeURIComponent when you are encoding a single value that will sit inside a URL, such as a search term, a file name or a parameter value. It encodes everything except letters, numbers and the characters - _ . ! ~ * ' ( ), so a value like "a b?x=1&y=2" becomes a single safe string that cannot be mistaken for extra parameters or a new path. Use encodeURI when you are encoding a whole URL that is already structured, such as a link a user pasted. It leaves the structural characters : / ? # [ ] @ ! $ & ' ( ) * + , ; = alone and encodes only the characters that are genuinely unsafe, such as spaces and non-English letters. Mixing the two up is a common bug: encoding a full URL with encodeURIComponent destroys its structure, while encoding a value with encodeURI leaves ampersands and question marks in place, which can split the value into extra parameters.

How Percent-Encoding Works

Percent-encoding works on bytes, not on characters. First the text is turned into UTF-8 bytes, then each byte that is not allowed in a URL is written as a percent sign followed by two hexadecimal digits. A space is one byte, 0x20, so it becomes %20. An accented letter like é is two bytes in UTF-8, 0xC3 and 0xA9, so it becomes %C3%A9. That is why encoded URLs sometimes look longer than you expect. On the receiving end, decoding reverses the process: each %XX sequence is turned back into its byte, and the bytes are read as UTF-8 text.

How to Use

  1. Type or paste your URL or text into the box. It can be a full link, a single value, or an already-encoded URL you want to read.
  2. Click Encode Component to encode a single value. Everything that could be mistaken for URL structure is encoded, so the result is safe to paste into a query string as one value.
  3. Click Encode Full URL to encode a whole link. The structure of the URL is kept, and only unsafe characters such as spaces are encoded.
  4. Click Decode URL to reverse the process. Percent-encoded sequences are turned back into readable characters. If the input contains a broken sequence such as a lone % sign, the tool shows an error instead of guessing.

Worked Example

Take the URL https://example.com/a b?x=1&y=2. Clicking Encode Component treats the whole string as one value and produces https%3A%2F%2Fexample.com%2Fa%20b%3Fx%3D1%26y%3D2. Every colon, slash, question mark and ampersand is encoded, so the result can be safely placed inside another URL as a single parameter. Clicking Encode Full URL instead gives https://example.com/a%20b?x=1&y=2, because the structure is kept and only the space becomes %20. Decoding either result returns the original URL. A simpler example: encoding the search term cats & dogs as a component gives cats%20%26%20dogs, which you can safely add to a link as https://example.com/search?q=cats%20%26%20dogs without the ampersand splitting your search into two parameters.

Frequently Asked Questions

What is the difference between encodeURI and encodeURIComponent?

encodeURI encodes a whole URL and keeps its structure, leaving characters like : / ? and & alone. encodeURIComponent encodes a single value and encodes those characters too, so the value cannot be mistaken for URL structure. Use the component version for values inside a query string.

Why is a space encoded as %20?

A space is not allowed in a URL, so it is percent-encoded as its byte value in hexadecimal: a space is byte 0x20, hence %20. In form data a space is sometimes written as a plus sign, but %20 is the correct form in a URL path or query.

What does percent-encoding do to non-English characters?

Non-English characters are first turned into UTF-8 bytes, and each byte is written as %XX. For example, é is two bytes, so it becomes %C3%A9. Decoding reverses the process and restores the original character.

Why does decoding show an error?

Decoding fails when the input contains a broken percent sequence, such as a percent sign not followed by two hexadecimal digits. Fix the sequence, for example by writing %25 for a literal percent sign, and decode again.

Is my URL private when I use this tool?

Yes. All encoding and decoding runs in your browser, and your URLs are never uploaded, stored or shared. Be careful with URLs that contain private tokens or passwords, though: do not share encoded versions of them either.

Related Calculators

Disclaimer: This tool runs entirely in your browser. Your data is never uploaded or stored. Do not paste secrets, passwords or private keys into any online tool.