HTML URL Encoding - Detailed Overview

Introduction to URL Encoding

URL encoding, also known as percent encoding, is a method of encoding reserved characters in URLs to ensure they are transmitted correctly over the internet. Reserved characters include spaces, punctuation, and other special characters.

How URL Encoding Works

URL encoding replaces reserved characters with a "%" followed by two hexadecimal digits that represent the character's ASCII code. For example:

Space: %20
Exclamation Mark: %21

Examples

Here are some examples of URL encoding:

Original URL: https://www.shariqsp.com/hello world
Encoded URL: https://www.shariqsp.com/hello%20world
Original URL: https://www.shariqsp.com/hello!world
Encoded URL: https://www.shariqsp.com/hello%21world

Encoding Reserved Characters

Here are some common reserved characters and their encoded equivalents:

Character Encoded
Space %20
! %21
# %23
$ %24
& %26
' %27
( %28
) %29
* %2A
+ %2B