HTML Basics

HTML URL Encoding

URLs can only contain a limited set of characters. URL encoding replaces unsafe characters, like spaces, with a safe percent code so links work reliably.


What is URL Encoding?

URL encoding (also called percent-encoding) converts characters that are not allowed in a URL into a percent sign followed by two hexadecimal digits. For example, a space becomes %20.

This is needed because spaces and many symbols would otherwise confuse the browser or server when reading a web address.

Common Encoded Characters

CharacterEncoded as
space%20
! (exclamation)%21
# (hash)%23
& (ampersand)%26
+ (plus)%2B
/ (slash)%2F
? (question mark)%3F
@ (at sign)%40
A link with encoded spaces
<a href="https://example.com/my%20great%20page.html">
  My great page
</a>
💡

You rarely encode by hand. In JavaScript, encodeURIComponent() encodes a value for you, and browsers automatically encode many characters when following links.

Ready to use your HTML skills?

Find web development internships and fresher jobs across India.

Browse Web Dev Internships