URL encoder / decoder
Encode special characters in URLs for safe transmission, or decode percent-encoded URLs back to readable text.
How URL encoding works
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.