URL Encoder / Decoder
Safely encode or decode uniform resource locators (URLs) and query parameters.
What is URL Encoding (Percent-Encoding)?
URL encoding, also known as percent-encoding, is a mechanism for encoding information in a Uniform Resource Identifier (URI). URLs can only be sent over the Internet using the ASCII character-set. Since URLs often contain characters outside the ASCII set, the URL has to be converted into a valid ASCII format.
URL encoding replaces unsafe ASCII characters with a % followed by two hexadecimal digits. For example, a space is encoded as %20 or a plus sign +.
Reserved vs Unreserved Characters
Characters in a URI are classified as either reserved or unreserved:
- Reserved Characters: These characters sometimes have special meaning in a URL (like
?,&,/,=). If data being passed in a URL contains these characters, they must be encoded so they aren't accidentally interpreted as part of the URL's structure.! * ' ( ) ; : @ & = + $ , / ? % # [ ] - Unreserved Characters: These characters have no special meaning and never need to be encoded.
A-Z a-z 0-9 - _ . ~
Why is URL Encoding Important?
- Query Parameters: Passing data like names, email addresses, or search terms safely in a URL string (e.g.
?query=hello%20world). - API Requests: Ensuring that JSON strings or complex data passed in REST API endpoints don't break the routing.
- Form Submissions: Standard HTML form data submitted via the
GETmethod is automatically URL encoded by the browser before being sent.