Stays in your browser
URL Encode / Decode Online
Free URL encoder and decoder. Encode or decode query values and path segments with encodeURIComponent — locally in your browser.
Encoding URLs correctly, at the right level
A URL has components with different rules. A space is encoded the same way in a path and a query string, but a plus sign means a space only in the query, and a slash inside a path segment must be encoded while the slashes separating segments must not be. Encoding an entire URL in one pass therefore breaks it.
Two functions are routinely confused. The component encoder escapes everything outside the unreserved set, which is what you want for a single value, while the URL encoder leaves structural characters such as colon, slash, question mark and hash alone, which is what you want for a whole address. Applying the first to a complete URL encodes its separators and produces one very long path.
Double encoding is the silent failure. Pass a value through an encoder twice and a percent sign becomes the encoding of a percent sign, so after one round of server-side decoding the application receives the literal escape sequence. When a value arrives mangled, count the escape sequences rather than reading the decoded result.
FAQ
- When do I need URL encoding?
- When text includes spaces, non-ASCII, or reserved characters like & ? = in a query value.
- encodeURI vs encodeURIComponent?
- This tool uses encodeURIComponent, which is right for individual parameter values.
- Is my text uploaded?
- No. Encoding runs entirely in your browser.
- What is the difference between %20 and a plus sign?
- Both can represent a space, but a plus sign only means a space in a query string, where an older convention defined it that way. In a path, a plus is a literal plus. Encoding spaces as the percent form is the safe choice in every part of a URL.
- Why is my URL encoded twice?
- Because a value was escaped for transport and then escaped again as part of a larger URL. Each pass turns a percent sign into its own escape sequence, so a space encoded once becomes a space encoded twice. Encode components first, then assemble the URL without re-encoding it.
- Should I encode slashes inside a URL?
- Only when the slash is part of a value rather than a separator. A slash that separates path segments must stay literal, or the path collapses into a single segment; a slash inside a parameter value must be encoded, or the server treats it as a new directory level.