URL Encoder
Percent-encode text for safe use in URLs. For query parameters, path segments, form submissions, and anywhere reserved characters need escaping.
About URL Encode
URL encoding (also called percent-encoding, per RFC 3986) replaces reserved and non-ASCII characters with a "%XX" sequence, where XX is the two-digit hex value of the byte. A space becomes %20 (or + in form-data context), a question mark becomes %3F, an em-dash becomes %E2%80%94 (three bytes in UTF-8, each encoded). This encoder uses the browser's native encodeURIComponent, which encodes every character that isn't in the safe set — the right default for single query-parameter values. Use the encoder when: building a query string programmatically and any of the values might contain reserved characters (?, &, =, #, +, /); constructing a path segment from user input that could include slashes you want to survive as literal characters; putting arbitrary text into a URL fragment (#foo bar) where the browser would otherwise mangle whitespace; generating OAuth state parameters or callback URLs where the embedded data must round-trip unchanged. Don't use encodeURIComponent on a whole URL — it'll encode the structural characters (://, &, =) that need to stay literal for the URL to parse. Use encodeURI or manual parsing for that. The rule of thumb: encodeURIComponent for values, encodeURI for full URLs, URL constructor for anything structural.
Features
- Encode special characters for safe URL transmission
- Decode percent-encoded URLs back to readable text
- Handle all special and unicode characters
- Copy encoded or decoded output instantly
How to Use
- Paste your URL or text into the input field
- Select "Encode" or "Decode" mode
- View the result instantly
- Copy the output using the copy button
Frequently Asked Questions
Should I use encodeURI or encodeURIComponent?
encodeURIComponent for single values (query parameter values, path segments); encodeURI for whole URLs that still have structural characters (://, &, =) that need to stay literal. This tool uses encodeURIComponent by default because "encode this text" usually means "for a value", not "for a whole URL".
Why are some characters like ~ and * not encoded?
RFC 3986 includes them in the "unreserved" set — safe anywhere in a URL without encoding. The unreserved set is letters, digits, and - _ . ~. Older standards (RFC 2396) encoded * and ~, but modern tools follow RFC 3986 and leave them alone. Both forms decode identically.
How does URL encoding handle Unicode?
Unicode characters are encoded as their UTF-8 byte sequence, each byte written as %XX. "€" (U+20AC) is encoded as %E2%82%AC — three percent-escaped bytes. The decoder reverses this automatically. Non-UTF-8 source encodings (Latin-1, Shift-JIS) don't round-trip without pre-conversion.
Why does a space become + in some contexts and %20 in others?
Query strings historically encoded spaces as + (HTML form submissions use application/x-www-form-urlencoded, which defines + = space). Modern APIs use %20. Browsers decode both correctly on the URL's query portion, but not in the path. This encoder emits %20 consistently, which is always safe.