What is URL encoding?
URLs can only safely contain a limited set of characters. Spaces, accented letters, and symbols like &, =, ?, #, and / either are not allowed or carry a special meaning in the address. URL encoding, also called percent-encoding, replaces each unsafe character with a percent sign followed by two hexadecimal digits. A space becomes %20, for example, and a slash becomes %2F.
Characters outside basic ASCII are first converted to UTF-8 bytes, and each byte is then written in percent form, so one accented letter or emoji can become several percent groups. Letters, digits, and a few marks such as hyphen, underscore, period, and tilde are left alone.
When you need to encode text for a URL
Encoding matters whenever you put a value inside a link. If a search term, redirect address, or filename contains an ampersand or equals sign and you do not encode it, the receiving server may read it as the start of a new parameter and get the wrong data. A typical case is passing one full URL as the value of a query parameter, like a "next" or "redirect" field.
It is also helpful when debugging tracking links, building API requests by hand, or fixing links that break because of spaces or non-English characters. To reverse the process and read what an encoded string says, use the URL Decoder.
How to encode text with this tool
- Type or paste your text into the "Text to encode" box. It starts with an example web address that includes a space.
- Read the "Result" box below. It updates as you type, so there is no encode button.
- Click Copy to copy the encoded result.
The encoding is done in your browser, so what you type is not sent to a server. Note that the example input is a full address. When you encode a whole URL here, every special character in it gets converted, as explained below.
Encoding a whole URL versus encoding one value
This tool encodes everything that is not a plain letter, digit, or one of a few safe marks. That includes the colon, slashes, question mark, ampersand, and equals sign. This is exactly what you want for a single value that will be placed inside a query string, such as one parameter's content. It is not what you want for a complete URL you intend to open directly, because "https://" would become "https%3A%2F%2F" and stop working as a link.
The right approach is to encode only the pieces that vary, like a search phrase or a redirect target, and then insert the result into the rest of the address. Avoid encoding the same text twice, since a percent sign itself gets encoded to %25 and the value will then decode into the first encoding rather than the original. If you meant to get back to the original text and see odd %25 sequences, you have probably encoded it twice.