URL Encoder/Decoder

Encode and decode URLs, query strings, and URI components into percent-encoded ASCII representations with support for full URI, component, and form data modes.

URI Source Content

Processed Output
encoded Result

Mode

encode

Input Chars

67

Output Chars

0

Length Delta

+-100.0%

Best Practice for Query Strings

Always use encodeURIComponent for individual query key and value pairs, but use encodeURI when encoding entire absolute destination URLs.

RFC 3986 Percent-Encoding Specification

URL encoding maps 8-bit octets outside the unreserved ASCII character set to a triplet consisting of the percent character "%" followed by two hexadecimal digits representing the byte value.

1. Percent-Encoding Transposition Mapping
Byte(b)% HEX₁HEX₀whereHEX = hexadecimal(ASCII(c))
2. RFC 3986 Unreserved Character Domain
Unreserved Set={ A–Z, a–z, 0–9, '-', '_', '.', '~' }
Step-by-Step URL Query Parameter Encoding Breakdown
Step 1: Identify Reserved Characters in Query
Input: "user=jane&city=New York" contains spaces and reserved &, = delimiters.
Step 2: Convert Reserved Glyphs to Hex Codes
Space (ASCII 32) → %20
'=' (ASCII 61) → %3D
'&' (ASCII 38) → %26
Step 3: Assemble Safe URI Component
Encoded Query=user%3Djane%26city%3DNew%20York

Common URL Reserved Characters Reference

CharacterHex Percent CodeDescription / RoleencodeURI Preservation
␣ (space)%20 or +Word separatorEncoded (%20)
/%2FPath segment separatorPreserved (/)
?%3FQuery string initiatorPreserved (?)
&%26Query parameter delimiterPreserved (&)
#%23Fragment identifier / hash anchorPreserved (#)

Frequently Asked Questions

What is URL encoding (percent-encoding)?
URL encoding converts reserved characters into percent signs followed by two hexadecimal digits (%XX) corresponding to their UTF-8 byte code. This allows non-ASCII characters and special punctuation to pass through HTTP web requests safely.
What is the difference between encodeURI and encodeURIComponent?
encodeURI() preserves protocol delimiters (://, ?, #, &, =) and is intended for complete URLs. encodeURIComponent() escapes all reserved delimiters, making it essential for query parameter values to prevent injection and corruption.
Why do spaces encode as + in form data and %20 in URLs?
The application/x-www-form-urlencoded MIME standard specifies that spaces encode as '+'. The newer RFC 3986 standard specifies '%20'. Modern HTTP web servers parse both formats interchangeably.
Which characters are considered 'unreserved' and never encoded?
According to RFC 3986, unreserved characters are uppercase A–Z, lowercase a–z, digits 0–9, and the four symbols hyphen (-), underscore (_), period (.), and tilde (~).

Related Tools