A parameter value containing reserved characters
Input
a+b=c d
Result
a%2Bb%3Dc%20d
The plus sign is escaped because many form parsers read a literal + as a space. The = would otherwise be read as a parameter separator.
Encode URLs safely for redirects, query parameters, and API requests.
https%3A%2F%2Fsoftkey-tools.local%2Fsearch%3Fq%3Dangular%20tools%26mode%3Dphase%201
Understand the format
Percent-encoding replaces characters that have structural meaning in a URL with a % followed by their byte value in hexadecimal, so data cannot be mistaken for syntax.
RFC 3986 divides characters into three groups. Unreserved characters, which are A-Z, a-z, 0-9, hyphen, period, underscore, and tilde, never need encoding. Reserved characters such as ? & = # / : have structural meaning: they separate the query from the path, one parameter from the next, and the fragment from everything else. Any other character, including spaces and every non-ASCII character, must be percent-encoded.
The encoding itself is mechanical. The character is converted to bytes using UTF-8, and each byte becomes a percent sign followed by two hexadecimal digits. A space becomes %20, an ampersand becomes %26, and the euro sign, being three bytes in UTF-8, becomes %E2%82%AC.
This tool performs component encoding, the equivalent of encodeURIComponent. It escapes reserved characters too, which is exactly what you want for a single parameter value, and exactly what you do not want for a complete URL. Encode "https://example.com" as a component and the slashes and colon are escaped, which is correct when that URL is being carried inside another URL as a redirect target.
So the rule is about position, not about the string: encode each value as you place it into a query string, and never encode the URL you are building at the end. Getting this backwards produces the two classic failures, a broken link or a double-encoded one.
Step by step
Encoding is performed by the browser encodeURIComponent function in the page, so callback URLs containing internal hostnames never leave your machine.
Worked examples
Input
a+b=c d
Result
a%2Bb%3Dc%20d
The plus sign is escaped because many form parsers read a literal + as a space. The = would otherwise be read as a parameter separator.
Input
https://ex.com/p?q=a b&r=1#top
Result
https%3A%2F%2Fex.com%2Fp%3Fq%3Da%20b%26r%3D1%23top
Correct when this value is assigned to something like ?next=. The whole thing is now one opaque parameter value rather than several parameters.
Reference
| Character | Encoded | Why it matters in a URL |
|---|---|---|
| space | %20 | Terminates the URL in many parsers and breaks HTTP request lines. |
| & | %26 | Separates query parameters, so an unescaped & splits one value into two. |
| = | %3D | Separates a parameter name from its value. |
| ? | %3F | Starts the query string. |
| # | %23 | Starts the fragment; everything after it is never sent to the server. |
| / | %2F | Path separator. Must be escaped inside a value, left alone in the URL itself. |
| + | %2B | Read as a space by form-encoded parsers, which silently corrupts values. |
| % | %25 | Begins an escape sequence, so a literal percent must itself be escaped. |
Practical Guide
Troubleshooting
FAQ
encodeURI keeps the characters that make a URL work, so it is for whole URLs. encodeURIComponent escapes reserved characters as well, so it is for individual values. This tool behaves like encodeURIComponent.
%20 is correct everywhere in a URI. The + form is specific to form-encoded bodies and query strings produced by HTML forms. When in doubt, use %20.
They must be encoded as UTF-8 bytes first. Browsers display the readable form but transmit the percent-encoded bytes.
Browsers quietly repair some malformed URLs, for example escaping spaces for you. HTTP clients and servers generally do not, which exposes the encoding bug.
No. It preserves structure, nothing more. Open-redirect and injection risks still require validating the destination and escaping output correctly in the receiving context.
Go deeper