Updated June 2, 2023
Introduction to HTML URL Encoding
In this article, we will learn about HTML URL Encoding in detail. HTML URL is an acronym of Uniform Resource Locator to global or IP address on the World Wide Web. The web server gets the page using the URL for the web browser.
Example: https://www.google.com is one of the URLs.
ASCII character set is important for HTML URL Encoding. URL is sent to the internet using the ASCII Character set. Non-ASCII character is restricted because they may create conflict in finding the page path to the server. Because of this problem, HTML uses URL Encoding.
HTML URL Encoding converts the Non-ASCII character into a format that can send to the internet. Users can be converted using “%” to continue with two hexadecimal digits.
How to Perform URL Encoding in HTML?
- HTML language creates URL using <a> tag and href attribute. For Example, <a href=https://www.google.com/>. Write the file name if you make any website and want to go from one page to another. <a href=”page1.html”>.
- Some characters are restricted to web address names because of conflict creation; non-ascii character replaces with “% ” to continue with two hexadecimal digits.
- URL does not hold space. It takes the place of the plus sign (+) or %20. In the form of the HTML page, space occurs in the “input” text output, then plus sign shows. Indirectly space occurred in a URL name, then %20 shows.
- URL tags contain uppercase letters(A- Z), lowercase letters(a- z), decimal digits(1-9), and some special characters.
If I put space in the form, then the URL Encoding comes as HTML+CSS.
<a href="my file.html">
If we give space in any URL, URL Encoding will occur as my%20file.html.
- Reserved Characters: There are some characters with some meaning in the URL address, and we can use naming purposes. We can use both ways, like plus (/) sign used for a separate URL part. Another hand, we can / encode by %2f without meaning in the name of the address.
- Unsafe Characters: Many characters misunderstand the URL address, like space in the URL name. Instead of take space in URL address name <a href=”pa ge.html”>, write <a href =”pa%20ge.html”>. Then the URL name seems “pa ge.html”.
- Non-ASCII Control Characters: These Characters Include the Set of An 80-Ff Hex Value, Which Is a Need to Convert in Format.
- ASCII Control Characters: There Are Not Working Inside of the URL.
Examples of HTML URL Encoding
Following are the examples of HTML URL Encoding explained in detail:
1. Reserved Characters Encoding
Following is the Table Utilized for Encoding Reserved Characters.
Characters | $ | & | + | , | / | : | ; | = | ? | @ |
URL Encode | 24% | 26% | %2b | %2c | %2f | %3a | %3b | %3d | %3f | 40% |
2. Unsafe Characters
Following is the Table Utilized for Encoding Unsafe Characters.
Characters | space | “ | < | > | # | % | { | } | | | \ | ^ | ~ | [ | ] |
URL Encode | 20% | 22% | %3c | %3e | 23% | 25% | %7b | %7d | %7c | %5c | %5e | %7e | %5b | %5d |
3. Non-ASCII Control Character
Following is the Table Utilized for Encoding Non-ASCII Characters.
Character | URL Encode | Character | URL Encode | Character | URL Encode | Character | URL Encode |
€ | %80 | ˜ | %98 | « | %ab | ¿ | %bf |
‚ | %82 | ™ | %99 | ¬ | %ac | À | %c0 |
ƒ | %83 | š | %9a | ª | %aa | Á | %c1 |
„ | %84 | › | %9b | ® | %ae | Â | %c2 |
… | %85 | œ | %9c | ¯ | %af | à | %c3 |
† | %86 | | %9d | ° | %b0 | Ä | %c4 |
‡ | %87 | ž | %9e | ± | %b1 | Å | %c5 |
ˆ | %88 | Ÿ | %9f | ² | %b2 | Æ | %v6 |
‰ | %89 | × | %d7 | ³ | %b3 | Ç | %c7 |
Š | %8a | ¡ | %a1 | ´ | %b4 | È | %c8 |
‹ | %8b | ¢ | %a2 | µ | %b5 | É | %c9 |
Œ | %8c | £ | %a3 | ¶ | %b6 | Ê | %ca |
Ž | %8e | ¤ | %a4 | · | %b7 | Ë | %cb |
‘ | %91 | ¥ | %a5 | ¸ | %b8 | Ì | %cc |
’ | %92 | ¦ | %a6 | ¹ | %b9 | Í | %cd |
“ | %93 | § | %a7 | º | %ba | Î | %ce |
” | %94 | ¨ | %a8 | » | %bb | Ï | %cf |
• | %95 | © | %a9 | ¼ | %bc | Ð | %d0 |
– | %96 | — | %97 | ½ | %bd | Ñ | %d1 |
ã | %e3 | Þ | %de | ¾ | %be | Ò | %d2 |
æ | %e6 | ß | %df | Ø | %d8 | Ó | %d3 |
ä | %e4 | à | %e0 | Ý | %dd | Ô | %d4 |
4. ASCII Control Characters
Following is the Table Utilized for Encoding Ascii Characters.
ASCII Character | URL-Encoding |
NUL – null character | %00 |
SOH – the start of the header | %01 |
STX – the start of the text | %02 |
ETX – end of the text | %03 |
EOT – end of the transmission | %04 |
ENQ – enquiry | %05 |
ACK – acknowledge | %06 |
BEL – bell (ring) | %07 |
BS – backspace | %08 |
HT- horizontal tab | %09 |
LF- line feed | %0A |
VT- vertical tab | %0B |
FF- form feed | %0C |
CR- carriage return | %0D |
SO- shift out | %0E |
SI- shift in | %0F |
DLE- data link escape | %10 |
DC1- device control 1 | %11 |
DC2- device control 2 | %12 |
DC3- device control 3 | %13 |
DC4- device control 4 | %14 |
NAK- negative acknowledge | %15 |
SYN- synchronize | %16 |
ETB- end transmission block | %17 |
CAN- cancel | %18 |
EM – end of medium | %19 |
SUB- substitute | %1A |
ESC- escape | %1B |
FS -file separator | %1C |
GS- group separator | %1D |
RS- record separator | %1E |
US- unit separator | %1F |
Importance of URL Encoding in HTML
If the URL is reserved, Unsafe, and Not ASCII Characters, the URL address becomes more complicated and ununderstandable. When a web browser searches URL addresses, the Web Server searches the name or path of the URL. If the URL name is not ASCII, finding the URL Importance of URL Encoding in HTML is difficult.
URL address must be easy to find, universally accepted, and understandable for all web browsers and servers. Some characters misunderstand URL because they are used for some purpose if it is not used for any purpose. That time conflict might have occurred, and the path does not reach the user.
To overcome all difficulties and make it easy to use Non-ASCII characters converted into ASCII code using % to come up with two hexadecimal.
Conclusion
URL Encoding in HTML knows how to convert the Non-ASCII set of characters to a valid ASCII set of format. It is universally accepted, and a web browser works without any errors. Encoding URLs can be run quickly and safely. To avoid conflict between naming and the purpose of naming, URL encoding is necessary.
Recommended Articles
This is a guide to HTML URL Encoding. Here we discuss the introduction to HTML URL encoding, how to perform URL Encoding in HTML, and its examples and importance. You may also look at the following articles to learn more-