/**/

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

CharacterEncodedUse Case
Space%20Most common encoding need
&%26Query param separator in values
=%3DQuery param key/value separator
?%3FQuery string start marker
#%23Fragment identifier
+%2BPlus 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.

Related Tools