Difference between Url Encode and HTML encode

Quintin Par picture Quintin Par · Nov 28, 2009 · Viewed 73.5k times · Source

What’s the difference between an URL Encode and a HTML Encode?

Answer

Mehrdad Afshari picture Mehrdad Afshari · Nov 28, 2009

HTML Encoding escapes special characters in strings used in HTML documents to prevent confusion with HTML elements like changing

"<hello>world</hello>" 

to

"&lt;hello&gt;world&lt;/hello&gt;"

URL Encoding does a similar thing for string values in a URL like changing

"hello+world = hello world"

to

"hello%2Bworld+%3D+hello+world"