URL Encoding Explained: When and Why to Encode URLs
Ever seen %20 in a URL and wondered what it means? That's URL encoding (also called percent-encoding), and getting it right is essential for web development.
What is URL Encoding?
URLs can only contain a limited set of characters. Spaces, special characters, and non-ASCII characters must be converted to a %XX format where XX is the hexadecimal value. For example, a space becomes %20, an ampersand becomes %26.
Why You Need It
- Query parameters - values containing
&,=, or?would break the URL structure - Spaces in filenames -
my file.pdfneeds encoding for valid URLs - International characters - non-ASCII letters and symbols must be encoded
- API requests - search queries, filter values, and user input in URLs need encoding
Reserved vs Unreserved Characters
Unreserved (safe as-is): letters, digits, -, _, ., ~
Reserved (have special meaning): : / ? # [ ] @ ! $ & ' ( ) * + , ; =
Reserved characters must be encoded when used as data (inside a query value), but kept as-is when used structurally (separating path segments).
Encode and Decode with Toolium
Use the URL Encoder/Decoder to encode text for safe inclusion in URLs, or decode percent-encoded strings back to readable text. Handles full Unicode including emoji and CJK characters.
Try the tool mentioned in this article
Open tool