How this calculation works
The URL Encoder & Decoder performs percent-encoding (RFC 3986) to escape reserved and unsafe characters in URL parameters and API query strings.
Mathematical formula and logic
Replaces non-alphanumeric characters with '%' followed by their two-digit hexadecimal ASCII representation (e.g. space -> %20, & -> %26).
Worked example
'https://www.calculatorall.online/search?q=mortgage rate & loans=100%' encodes spaces to '%20' and '%' to '%25'.
Calculation assumptions
- RFC 3986 Uniform Resource Identifier (URI) Generic Syntax compliance.
- UTF-8 character percent-encoding.
Frequently asked questions
Why is URL encoding necessary?
URLs can only contain a limited set of ASCII characters. Characters like spaces, ampersands (&), question marks (?), and slashes (/) have special syntactic meaning and must be percent-encoded to prevent breaking URL parsing.
What is the difference between encodeURI and encodeURIComponent?
`encodeURI` preserves protocol and path delimiters like 'http://', '?', and '&', whereas `encodeURIComponent` encodes all characters including delimiters, making it suitable for query parameter values.
What does %20 mean in a URL?
`%20` is the percent-encoded representation of a space character (ASCII code 32 = 0x20 hex).
Can plus (+) be used instead of %20 for spaces?
In URL query parameter strings (application/x-www-form-urlencoded), '+' is traditionally used to represent spaces, whereas `%20` is universally valid across both path and query strings.
How are non-English characters encoded in URLs?
Non-ASCII characters (like accents, Cyrillic, or Chinese characters) are converted to their UTF-8 byte sequences and each byte is percent-encoded (e.g. 'é' becomes '%C3%A9').