How to use the URL encoder and decoder
- Choose Encode or Decode, then type or paste your text. The result updates as you type.
- When encoding, choose whether the text is a value (such as a query parameter) or a complete URL.
- If the input is a complete URL, the URL breakdown shows its parts and every query parameter, decoded.
Encoding a value or a complete URL?
A value encodes every character that has a special meaning in URLs, including / ? & = #. Use it for query parameter values and path segments; it matches JavaScript's encodeURIComponent and .NET's Uri.EscapeDataString.
A complete URL keeps the characters that structure a URL and only encodes what's invalid, such as spaces and non-ASCII characters. It matches JavaScript's encodeURI.
Spaces as + produces form encoding (application/x-www-form-urlencoded), as used by HTML forms. Strict RFC 3986 also encodes ! ' ( ) *, which some signing schemes, such as OAuth 1.0, require.
URL encoding in C#
string value = Uri.EscapeDataString("café & co"); // caf%C3%A9%20%26%20co
string text = Uri.UnescapeDataString("caf%C3%A9"); // café
// Query strings with correct encoding
var query = System.Web.HttpUtility.ParseQueryString(string.Empty);
query["q"] = "café & co";
string encoded = query.ToString(); // q=caf%c3%a9+%26+co
Frequently asked questions
Is my text sent anywhere?
No. Encoding, decoding and URL parsing run entirely in your browser. Passwords in URLs are hidden in the breakdown.
Why does decoding fail with "isn't a valid escape"?
A % must be followed by two hexadecimal digits. A literal percent sign has to be written as %25.
Which character encoding is used?
UTF-8, as required by modern web standards. Each non-ASCII character becomes several %XX bytes; é is %C3%A9.