URL Encoder / Decoder
Percent-encode URLs for safe transmission or decode encoded strings back to plain text
Encoding type:
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.
Frequently Asked Questions
URL encoding converts unsafe characters into % followed by two hex digits. A space becomes %20, & becomes %26. This lets URLs safely contain any character.
encodeURI preserves /, :, ? and & (structural characters). encodeURIComponent encodes everything including those. Use encodeURIComponent for query parameter values.
URLs can only contain specific ASCII characters. Spaces aren't allowed. %20 is the hex ASCII code for space. In query strings, + is also used as a space alternative.
Spaces, special chars like !, #, $, &, (, ), +, /, :, =, ?, @, [ and ] must be encoded. Non-ASCII characters (accents, Chinese, emoji) must also be percent-encoded.