url-encoder

Encode or decode a URL / query string value, parse a full URL into its components, or build a URL from parts. Everything runs in your browser.

client-side only encodeURIComponent URL parser URL builder
input
output
url-parser — paste a full URL in the input above to parse it
Paste a URL in the input box above.
url-builder — assemble a URL from parts

// encodeURIComponent vs encodeURI

│

encodeURIComponent — encodes everything except A–Z a–z 0–9 - _ . ! ~ * ' ( ). Use this when encoding a value that will go inside a query string (e.g. ?q=hello+world → ?q=hello%2Bworld). It encodes /, ?, &, =, # and everything that has structural meaning in a URL.

│

encodeURI — encodes everything except characters that are valid in a full URL: letters, digits, and - _ . ! ~ * ' ( ) ; / ? : @ & = + $ , #. Use this when encoding a complete URL that you want to keep structurally intact.

The most common mistake: using encodeURI on a query parameter value. That leaves & and = unencoded, which breaks query string parsing when the value contains those characters.

// in .NET

│

Uri.EscapeDataString(value) — equivalent to encodeURIComponent. Use for query param values.

│

Uri.EscapeUriString(url) — equivalent to encodeURI. Deprecated in .NET 5+ for being ambiguous; prefer building URLs via UriBuilder or QueryHelpers.AddQueryString() in ASP.NET Core.

│

HttpUtility.UrlEncode(value) — encodes spaces as + instead of %20 (HTML form encoding, not RFC 3986). The two formats look similar but behave differently in decoders.