๐Ÿ”— Developer Tool

URL Encoder / Decoder

Encode and decode URLs instantly. Supports percent-encoding, form encoding and full URL encoding. See exactly which characters were encoded โ€” highlighted in real time.

Encoding method
Input text or URL
Characters: 0
Output
Output will appear hereโ€ฆ
Common encodings โ€” click to copy encoded value

URL encoding explained

URL encoding (percent-encoding) replaces unsafe ASCII characters with a % followed by two hexadecimal digits. For example, a space becomes %20, and an ampersand becomes %26.

๐Ÿ”‘ encodeURIComponent

Encodes ALL special characters except letters, digits, and - _ . ! ~ * ' ( ). Use this for query string values where you want the entire value treated as data, not URL syntax.

๐ŸŒ encodeURI

Encodes a complete URL but preserves URL-structural characters like / ? & = # :. Use when encoding an entire URL where these characters are part of the URL structure, not data.

๐Ÿ“‹ Form encoding

Used in HTML form submissions (application/x-www-form-urlencoded). Spaces become + instead of %20. This is the format of most login forms and search queries.

โšก When to use which

Passing a value in a query string โ†’ encodeURIComponent. Sharing a full URL โ†’ encodeURI. Submitting a form programmatically โ†’ form encoding. Most developers need encodeURIComponent.

Frequently asked questions

Characters that must be encoded include: space ( ), !, ", #, $, %, &, ', (, ), *, +, comma, /, :, ;, =, ?, @, [, ], and any non-ASCII characters. Letters (aโ€“z, Aโ€“Z), digits (0โ€“9), and the characters - _ . ~ are always safe and never encoded.
%20 is the standard percent-encoding for space and is used in URL paths. The + sign represents space only in application/x-www-form-urlencoded format (HTML form data). Use %20 in URL paths and + in form query strings to avoid confusion.
Use encodeURIComponent() for any user-supplied data going into a URL. Example: if a user searches for "hello world & more", encode it as "hello%20world%20%26%20more" and append to your URL: /search?q=hello%20world%20%26%20more
Double encoding happens when an already-encoded URL is encoded again: %20 becomes %2520 (the % itself gets encoded as %25). This causes broken links and security issues. Always decode first if you suspect the string is already encoded before re-encoding.
๐Ÿ”— Related tools