Encode special characters in URLs for safe transmission, or decode percent-encoded URLs back to readable text.
URL encoding (also called percent-encoding) converts characters that are not allowed or have special meaning in URLs into a safe format. Each unsafe character is replaced by a percent sign (%) followed by its two-digit hexadecimal ASCII code. For example, a space becomes %20, the # symbol becomes %23, and & becomes %26.
This tool uses JavaScript's encodeURIComponent(), which encodes everything except A–Z, a–z, 0–9, and the characters - _ . ! ~ * ' ( ). This is the correct function for encoding individual query parameters or path segments. The related function encodeURI() is less strict and preserves characters like / ? # & that have structural meaning in a full URL. Decoding uses the corresponding decodeURIComponent(). Double-encoding is a common mistake — encoding an already-encoded string turns %20 into %2520, which breaks URLs. Always decode first if your string might already be encoded.
URL encoding (percent-encoding) converts characters that are not allowed in URLs into a safe representation using a % sign followed by the character's hexadecimal ASCII code. For example, spaces become %20, & becomes %26, and = becomes %3D.
You need to URL-encode values you insert into query parameters or URL path segments — especially user-generated content, search terms, file paths, or any text that might contain spaces, special characters, or non-ASCII characters like accented letters or CJK characters.
encodeURI() encodes a complete URL and preserves characters with structural meaning (/, ?, #, &, =, :). encodeURIComponent() is more aggressive and encodes everything except basic unreserved characters — it is correct for encoding individual parameter values within a URL.
Double encoding happens when an already-encoded string (like %20) is encoded again, turning it into %2520. This causes broken URLs or incorrect values on the server. Always check whether your string is already encoded before encoding it again.