URL Encoder / Decoder
Percent-encode URLs for safe transmission or decode encoded strings back to plain text
Invalid URL encoding
Common URL Encoding Reference
URL Encoding Explained
URL encoding (also called percent-encoding) converts characters that cannot appear in a URL into a safe format. Each unsafe character is replaced with a % followed by its two-digit hexadecimal ASCII code. For example, a space becomes %20, the ampersand & becomes %26, and the equals sign = becomes %3D.
There are two common encoding functions: encodeURI encodes a full URL while preserving structural characters like /, ?, and &. encodeURIComponent encodes a URL component (like a query parameter value) and also encodes those structural characters. Use encodeURIComponent when encoding individual query string values.
Worked example: encoding the query value "hello world & more" with encodeURIComponent gives hello%20world%20%26%20more. Feeding a full URL like https://example.com/search?q=hello world through encodeURI instead preserves the ://, ?, and = and only encodes the space: https://example.com/search?q=hello%20world.
Frequently Asked Questions
Advertisement