URL Encoder / Decoder
Safely encode or decode URLs and query string parameters.
Output
What is URL Encoding?
URL encoding (percent-encoding) converts characters that are not allowed in URLs into a %-prefixed hexadecimal representation. For example, a space becomes %20, and & becomes %26. This is essential when constructing URLs with dynamic data from user input or API responses.
In C#, use Uri.EscapeDataString() or System.Net.WebUtility.UrlEncode()to encode URL components programmatically.
Common Encoded Characters
| Character | Encoded | Use Case |
|---|---|---|
| Space | %20 | Most common encoding need |
& | %26 | Query param separator in values |
= | %3D | Query param key/value separator |
? | %3F | Query string start marker |
# | %23 | Fragment identifier |
+ | %2B | Plus sign (space alternative in forms) |
Frequently Asked Questions
What is URL encoding?
URL encoding converts special characters to %XX hex format for safe transmission in URLs. Space becomes %20, & becomes %26.
When do I need to URL encode?
When passing strings as query parameters, especially if they contain spaces, special chars like &, =, ?, #.
encodeURI vs encodeURIComponent?
encodeURI encodes a full URL (leaves /, ?, & intact). encodeURIComponent encodes a single component value (encodes everything including /, ?, &).
How do I URL decode in C#?
Use Uri.UnescapeDataString() or System.Net.WebUtility.UrlDecode() in .NET.
What characters must be URL encoded?
Spaces, &, =, ?, #, %, +, and any non-ASCII Unicode characters must be encoded in URLs.