HTML URL Encoding
Subject: html
š HTML URL Encoding
URL Encoding, also known as percent encoding, is used to convert characters into a format that can be safely transmitted over the internet through a URL.
ā What Is URL Encoding?
URLs can only use the ASCII character set. Characters outside this range or reserved characters (like spaces or @, #, %) must be encoded.
This is done by replacing such characters with a percent sign (%) followed by two hexadecimal digits representing their ASCII value.
ā Characters That Require Encoding
- Spaces (
) - Symbols (
@,#,%,&,?, etc.) - Non-ASCII characters (
Ć©,Ʊ,ā, etc.) 
ā Example:
š£ Common Encoded Characters
| Character | Encoded Form | 
|---|---|
| Space | %20 | 
| # | %23 | 
| % | %25 | 
| & | %26 | 
| = | %3D | 
| ? | %3F | 
šµļø When Is URL Encoding Used?
- š Query Strings: 
?name=John Doeā?name=John%20Doe - š© Form Submissions (GET method)
 - š Path Parameters
 - š§ Email Links or Redirect URLs
 
š Example: HTML Form with URL Encoding
š Resulting URL on submission:
The space is encoded as %20 automatically by the browser.
š Key Takeaway
- URL encoding ensures special and non-ASCII characters are safely transmitted.
 - Characters are replaced with 
%followed by their ASCII hex value. - Especially important for query strings, form data, and dynamic URLs.
 - š§  Browsers automatically handle this encoding in form submissions and 
<a>links. 
Advertisement Slot 1
Advertisement Slot 2