
URL Encoding Explained: What %20, %3A, and %2F Actually Mean
You've definitely seen URLs like this: https://example.com/search?q=hello%20world&lang=en%2Cfr Those %20 and %2C tokens aren't random. They're percent-encoded characters -- and understanding them will save you from some truly annoying debugging sessions. How Percent Encoding Works URLs can only contain a limited set of ASCII characters. Anything outside that set gets converted to its UTF-8 byte value, prefixed with % . The process: Take the character Convert to UTF-8 bytes Each byte becomes %XX (hex value) Space (ASCII 32 = 0x20) becomes %20 Colon (ASCII 58 = 0x3A) becomes %3A Slash (ASCII 47 = 0x2F) becomes %2F For multi-byte characters like cafe with an accent on the e , each UTF-8 byte gets its own %XX . Quick Reference Table Character Encoded Purpose (space) %20 Most common encoding ! %21 Exclamation # %23 Fragment identifier $ %24 Dollar sign % %25 The escape character itself & %26 Query parameter separator + %2B Plus sign / %2F Path separator : %3A Port separator = %3D Key-value
Continue reading on Dev.to Tutorial
Opens in a new tab


