Percent-Encoding Explained: How %20 and Friends Work
Percent-encoding (URL encoding) replaces unsafe characters with %XX sequences. Learn how the hex values are derived, RFC 3986 rules, and edge cases.
Published:
Tags: encoding, url, developer-tools
Percent-Encoding Explained: How %20 and Friends Work You have seen in a URL. You probably know it represents a space. But do you know why it is specifically, how multi-byte characters like turn into three percent sequences, or why the same space sometimes appears as instead? This post answers all of that, from the byte level up. Computing the Encoding by Hand To encode any ASCII character manually: Find its decimal ASCII value Convert to hexadecimal (divide by 16, take remainder) Prepend Example: (used in email addresses in URLs) ASCII decimal: 64 64 ÷ 16 = 4 remainder 0 → hex Encoded: Example: ASCII decimal: 35 35 ÷ 16 = 2 remainder 3 → hex Encoded: You can verify any of these with a quick check in your browser console: --- Multi-Byte Characters: UTF-8 First, Then Percent-Encode ASCII…
All articles · theproductguy.in