URL Encoder
Percent-encode text for safe inclusion in URLs. Encodes spaces, special characters, and Unicode.
0 characters
0 characters
About URL Encoder
URL encoding (percent-encoding) replaces reserved and non-ASCII characters with %XX hex sequences so they can be safely included in a URL. This tool uses encodeURIComponent, which is the correct choice for individual URL components (query parameter values, path segments).
When to use it
- Building a query-string parameter that contains spaces or symbols
- Encoding a URL fragment for safe transport
- Embedding a user-supplied string into a URL template
- Preparing redirect URLs that need to survive multiple layers of encoding
How it works
Each character that isn't an unreserved character (A–Z, a–z, 0–9, -, _, ., ~) is replaced with one or more %XX sequences representing its UTF-8 bytes. encodeURIComponent handles all the encoding correctly for component-level use.
Examples
Hello world & friends!
Hello%20world%20%26%20friends!
café/🎉
caf%C3%A9%2F%F0%9F%8E%89
Frequently asked questions
- What's the difference between encodeURI and encodeURIComponent?
- encodeURI is for whole URLs and leaves reserved characters like : / ? # alone. encodeURIComponent (this tool) is for individual components and escapes everything that isn't an unreserved character — the right choice for query parameter values.
- Are spaces encoded as %20 or +?
- As %20. The + form is specific to application/x-www-form-urlencoded (HTML form submissions); %20 works everywhere.
- Does it handle non-ASCII characters?
- Yes. Non-ASCII characters are encoded as their UTF-8 bytes — for example, é becomes %C3%A9.