URL Encoder / Decoder
Encode or decode URL components.
What is URL Encoding?
URL encoding (also called percent-encoding) replaces unsafe or reserved characters in URLs with a percent sign followed by their hexadecimal value. For example, a space becomes %20 and an ampersand becomes %26. This ensures URLs are transmitted correctly, since characters like &, =, and ? have special meaning in query strings.
How to Use
- Paste a plain string or URL-encoded string into the input field.
- Click Encode to percent-encode the text, or Decode to convert it back to readable form.
- Copy the result to use in URLs, query parameters, or API requests.
Frequently Asked Questions
Which characters need to be URL encoded?
Reserved characters (&, =, ?, /, #, +) and unsafe characters (spaces, quotes, angle brackets, non-ASCII characters) must be encoded when used in URL path segments or query parameters. For example, a search query like "cats & dogs" must become "cats%20%26%20dogs" in a URL. Failing to encode these characters can break URL parsing or cause security vulnerabilities like open redirects.
What is the difference between encodeURI and encodeURIComponent?
encodeURI preserves characters that are valid in a complete URL (like :, /, ?). encodeURIComponent encodes everything except unreserved characters, making it suitable for query parameter values. Use encodeURI when encoding an entire URL, and encodeURIComponent when encoding individual parameter values. This tool uses encodeURIComponent since that's the most common need.
Why does a space sometimes appear as + and sometimes as %20?
The + encoding for spaces is specific to HTML form submissions (application/x-www-form-urlencoded). In standard URLs and URIs, spaces should be encoded as %20. Most server frameworks handle both, but %20 is the universally correct encoding per RFC 3986. When building REST API URLs, always prefer %20 for maximum compatibility.
