What is this calculator?
Percent-encodes text for safe use in URLs, or decodes a percent-encoded string. It offers two scopes because they escape different character sets: component encoding for a single query value, and full-URI encoding for a whole address.
Use it when:
- You are building a query string and a value contains spaces, ampersands, or slashes.
- You need to read a percent-encoded URL from a log or a redirect.
- You must decide whether to escape a whole URL or just one parameter within it.
Intended for: Web developers constructing or debugging URLs and query strings.
How is this calculated?
- The text is converted to UTF-8 bytes, and each byte that is not permitted unescaped is written as `%` followed by two hexadecimal digits.
- COMPONENT scope escapes aggressively, including the reserved characters `/`, `?`, `#`, `&`, `=`, and `:`. Use it for one query parameter value, where those characters would otherwise be read as structure.
- FULL URI scope leaves those reserved characters intact, because in a complete address they carry meaning. Use it for a whole URL you do not want to break.
- Decoding reverses the substitution, converting each `%XX` sequence back to its byte and then interpreting the result as UTF-8.
Example
Encoding `a b&c=d` as a single query parameter value (component scope).
- The space becomes `%20`.
- The `&` becomes `%26` and the `=` becomes `%3D`, so neither is read as query structure.
Result: `a%20b%26c%3Dd` — safe to place after `?q=` without breaking the query string.
Frequently asked questions
When should I use component scope rather than full URI?
Use component scope whenever you are encoding a VALUE that will sit inside a larger URL — a query parameter, a path segment. Use full URI only when escaping an entire address whose structural characters must survive.
Why is a space sometimes `%20` and sometimes `+`?
Percent-encoding uses `%20`. The `+` form belongs to the older `application/x-www-form-urlencoded` format used by HTML form submissions. This tool produces `%20`.
Why does decoding fail on some strings?
A malformed sequence — a `%` not followed by two valid hex digits, or bytes that do not form valid UTF-8 — cannot be decoded and is reported as an error rather than silently mangled.
Assumptions
What this calculator takes as given:
- The transformation is performed in your browser; the text you paste is not uploaded or stored.
- Input is treated as UTF-8 text.
- Percent-encoding is applied over UTF-8 bytes, per current URL standards.
Limitations
What this calculator cannot know or does not model:
- The `application/x-www-form-urlencoded` `+`-for-space convention is not produced or consumed.
- Internationalised domain names (punycode) are not converted.
- It does not validate that the result is a well-formed URL — only that the escaping is correct.
References
- RFC 3986 — Uniform Resource Identifier (URI): Generic Syntax — IETF. Defines reserved and unreserved characters and the percent-encoding mechanism.