Jun 11 2006

URL Escape Characters

Categories:


What is the % Code in My URL?

In order to prevent the misinterpretation of special characters such as a space, bracket (< and >), or % in the URL (which stands for Uniform Resource Locator - it is the address you see in your browser's address bar indicating the location of the website you are visiting), browsers parse certain special characters using escape characters. This explains why when you click on a link such as: domain.com/page one.htm you see it parsed in the address bar as domain.com/page%20one.htm. In this case the %20 is the escape character for the space.

Common URL Escape Characters


Table of URL Escape Characters
Character Escape Character Character Escape Character
Space %20 # %23
$ %24 % %25
& %26 @ %40
' %60 / %2F
: %3A ; %3B
< %3C = %3D
> %3E ? %3F
[ %5B \ %5C
] %5D ^ %5E
{ %7B | %7C
} %7D ~ %7E

Good Coding Practice

It is good coding practice to avoid the need for URL escape characters. As a rule of thumb, avoid using the special characters above when formulating a URI string (filename), and I recommend using the hyphen (-) instead of the underscore (_) (as all search engines recognize the hyphen as a space separator, but the same is not true for the underscore; and older browsers do not correctly interpret the underscore in CSS). If you must use the above characters make sure to escape them using the above escape characters so when the browser parses your code it will not misinterpret the link. It's important to note that these URL escape characters differ from HTML escape characters.

Looking for HTML (XHTML) Escape Characters?

Visit our page on HTML Escape Characters for a list of valid HTML (and XHTML) escape characters.

Average: 5 (4 votes)

Select your preferred way to display the comments and click "Save settings" to activate your changes.

HTML List?

Good stuff. Do you also have a list of common html escape characters handy?

HTML Escape Characters List

I'm working on that - I'll add it the next chance I get.

Thanks!

Thanks!

HTML Escape Characters List

Our HTML (and XHTML) Escape Characters List is finally complete.  Click the link in the article above to access the page.

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Textual smileys will be replaced with graphical ones.

More information about formatting options

Captcha
This question is used to make sure you are a human visitor and to prevent spam submissions.
Copy the characters (respecting upper/lower case) from the image.