URL Encoder
Percent-encode text and query parameters so they're safe to use in URLs.
Which characters get encoded
The encoder works like JavaScript's encodeURIComponent. It leaves letters, digits and these marks unchanged: hyphen, underscore, full stop, tilde, asterisk, apostrophe, both parentheses and the exclamation mark. Everything else becomes a percent sign and two hex digits per byte:
| Input | Encoded |
|---|---|
| space | %20 |
| & | %26 |
| = | %3D |
| / | %2F |
| ? | %3F |
| # | %23 |
| + | %2B |
| % | %25 |
| line break | %0A |
Encode the value, not the whole URL
Because :, /, ?, & and = are all encoded, pasting a complete address breaks it. The sample https://example.com/search?q=hello world&lang=en comes out as https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dhello%20world%26lang%3Den, which no browser will open as a link.
That output is right when the whole URL is itself a parameter value, such as a redirect target. Otherwise, encode each value on its own and assemble the URL around it. For a search term Tom & Jerry, encode just that, get Tom%20%26%20Jerry, and build ?q=Tom%20%26%20Jerry. Left unencoded, the & would start a new parameter.
Spaces, plus signs and non-English text
Spaces become %20, never +. HTML forms send spaces as + in query strings, but %20 is valid everywhere, so you don't need to change it. A literal plus sign is encoded as %2B. That matters for phone numbers like +44 and for Base64 values, which would otherwise be read as spaces on the server.
Non-ASCII characters are encoded as their UTF-8 bytes, one %XX per byte:
café→caf%C3%A9€5→%E2%82%AC5🙂→%F0%9F%99%82
Avoiding double encoding
Encoding is not idempotent. Run already-encoded text through again and every % becomes %25: %20 turns into %2520, and the receiving server sees a literal "%20" instead of a space. Before encoding, check whether your value already contains %XX sequences. Many frameworks and HTTP libraries encode query parameters for you, so encoding by hand first is a common cause of this bug.
Frequently asked questions
Why isn't the apostrophe or the asterisk encoded?+
The encoder follows encodeURIComponent, which treats those marks as safe in URLs. If a system you're sending to needs them encoded, replace ' with %27 and * with %2A by hand.
Should I use %20 or + for spaces?+
%20 works in paths and in query strings, so it's the safer choice. + only means a space in query strings sent in form format, and inside a path it stays a literal plus.
How do I reverse the encoding?+
Paste the encoded text into the URL Decoder, which turns %XX sequences and plus signs back into the original characters.
Embed this tool on your website
Free to use on blogs, school sites and intranets. Paste this code into your page's HTML; please keep the credit line.
<iframe src="https://utilityapp.lat/embed/convert/url-encode" title="URL Encoder" width="100%" height="600" style="border:0;max-width:760px" loading="lazy"></iframe> <p style="font-size:13px"><a href="https://utilityapp.lat/convert/url-encode">URL Encoder</a> by UtilityApp</p>