HTML Special Characters Conversion Tool and Routines

HTML special character converter

The easiest way to set a charset in your HTML is by using the Content-Type META tag. But if for some reason you cannot define a character set in your HTML files, you can HTML-encode special characters (such as characters with accents or the €-character). Your character will be shown correctly in almost all cases (if your font supports the character). HTML-encoded characters always start with an ampersand (&) and end with a semicolon (;). The number in between is the decimal number from the UTF-8 table.

Copy your normal text below (including special characters). Insert sample text

  Your HTML encoded text:

Programming routines


Use htmlentities( string  [, quote style, charset ] ) to convert your characters to HTML encoded characters. Example:

htmlentities('ë', ENT_COMPAT, 'UTF-8')

This outputs ë (and the string is HTML encoded)
ENT_COMPAT will convert double-quotes and leave single-quotes alone.
You can also specify a charset to define which charset should be used in the conversion. The default is UTF-8 (PHP 5.4.0+, default=ISO-8859-1/Latin 1 for older PHP versions).
More information