Encoding

XML Entities Encode/Decode

Encode and decode XML entities — the 5 predefined ones (ampersand, angle brackets, apostrophe, quote) and numeric character references.

Frequently asked questions

What are the 5 predefined XML entities?

XML only predefines five named entities: & (ampersand), < and > (angle brackets), ' (apostrophe), and " (quote). Anything beyond these needs a numeric character reference instead.

How is this different from HTML entity encoding?

HTML defines a much larger set of named entities (like   or ©), while strict XML only recognizes the five predefined ones — any other special character in XML must use a numeric reference like © or ©.

When do I need to escape XML entities?

Escape characters like < > & ' " whenever they appear in text content or attribute values in an XML document, so the parser doesn't mistake them for markup and fail to parse the file.