Why URLs need escaping
A URL has a defined structure, and a few characters carry meaning in it. A slash separates path segments, a question mark starts the query, an ampersand separates parameters, an equals sign joins a name to a value, and a hash starts the fragment. If your data contains one of these, or a space, it has to be escaped, so the receiving server reads it as data. Percent encoding does this by writing the byte as a percent sign and two hexadecimal digits. The default input a b&c becomes a%20b%26c. This page applies that to a single component, such as one query value or one path segment.
What stays and what changes
The unreserved characters from RFC 3986 are letters, digits, hyphen, period, underscore and tilde. These are never encoded. The JavaScript function encodeURIComponent, which this page follows, also leaves ! * ' ( ) unchanged, even though RFC 3986 lists them as reserved delimiters. Everything else is escaped, including space (%20), slash (%2F), question mark (%3F), equals sign (%3D), ampersand (%26), plus (%2B) and the hash sign (%23). The text ?q=1&r=2 becomes %3Fq%3D1%26r%3D2. Hex digits in the output are uppercase, which is the form RFC 3986 recommends.
Non-English characters
Characters outside ASCII are first converted to UTF-8 bytes, and each byte is escaped. The letter é becomes %C3%A9 because its UTF-8 bytes are C3 and A9. The euro sign becomes %E2%82%AC, three bytes, and an emoji takes four bytes and twelve characters of escapes. This is the standard behavior for modern URLs, and it is what browsers do when you click a link containing such text. A Japanese word of three characters, each needing three UTF-8 bytes, becomes nine escapes, 27 characters long, in the address. Older systems sometimes used Latin-1 or another code page, which gives a single escape, %E9, for the same letter, and mixing the two causes unreadable text. A strict UTF-8 decoder rejects %E9 on its own, which is how this page flags legacy links. If decoded output looks garbled, the source probably used a different character encoding than UTF-8.
Decoding rules
In decode mode, the page turns each %XX sequence into a byte and then reads the bytes as UTF-8. The input a%20b%26c becomes a b&c. A percent sign that is not followed by two hexadecimal digits is rejected, and so is a sequence of bytes that is not valid UTF-8, such as a lone %C3. This strictness avoids silently accepting damaged links. Characters that are not escaped pass through unchanged. Decoding twice is a mistake that can change legitimate text: a value that originally contained the literal text %20 is escaped as %2520, and a single decode returns %20.
The plus sign and form encoding
In a URL query written by an HTML form, spaces are often sent as plus signs, under the application/x-www-form-urlencoded format. That is a different rule from plain percent encoding. This page does not apply it. When encoding, a space becomes %20 and a plus becomes %2B. When decoding, a plus stays a plus. If you are decoding a query string that came from a form and want the plus signs read as spaces, replace them with spaces first or use a form-aware parser. Mixing the two rules is a classic source of bugs, such as email addresses with a plus losing the plus on the way. When you build a link by hand, escape the plus as %2B in any value that might contain one, and your link will survive both kinds of parser. Some frameworks decode a query automatically, so check whether your server has already converted plus signs before you decode again.
Component versus whole URL
Encode the parts, not the whole address. If you encode https://example.com/a b, the colon and slashes are escaped as well, and the result is no longer a working URL. The right method is to build the URL from its pieces, encoding each path segment and each query value separately and leaving the delimiters alone. For example, a search term like rock & roll belongs in a query as rock%20%26%20roll. This page deliberately does not offer a whole-URL mode. It treats the input as a component, which is the safe default for data inserted into a link.
Worked examples
A file name such as Q3 report (final).pdf encodes to Q3%20report%20(final).pdf, since the parentheses are left alone by this function and the spaces are escaped. An email address user+tag@example.com becomes user%2Btag%40example.com. A search for café au lait becomes caf%C3%A9%20au%20lait. To check a value you have seen in a log, paste the escaped form in decode mode and read the original. If a link breaks after you paste a value into it, encode the value first and test again. A path segment containing a slash must be encoded as %2F or it will be read as two segments. A search for 100% organic needs the percent sign escaped, giving 100%25%20organic, because a bare percent sign followed by a space is not a valid escape.
Security notes
Percent encoding is not a security measure. It makes data safe for the URL grammar and does nothing to protect against injection attacks, so output encoding for HTML, SQL and shell contexts remains necessary. Attackers also use encoded sequences to hide characters such as dots and slashes in path traversal attempts, which is why servers must decode before validating, and only once. Do not put passwords or tokens in URLs that might be logged by proxies and browsers. When you decode an unknown link, read the result before opening it, since encoded text can conceal the real destination.
Malformed percent escapes in URL decoding
Input is processed in your browser and limited to 1 MiB of UTF-8 text. Malformed percent escapes and invalid UTF-8 byte sequences are rejected on decode. The page encodes and decodes a URI component only. It does not parse URLs, handle punycode for international domain names, apply the form rule for plus signs or normalize the text. Characters that encodeURIComponent leaves alone, such as parentheses and the apostrophe, remain unescaped, so add your own escapes if a particular system requires them. For strict RFC 3986 output, replace those five characters with %21, %2A, %27, %28 and %29 after encoding. The percent signs in your result are part of the data and should be copied exactly, since changing their case or dropping one changes the meaning.