XHTML is the strict XML reformulation of HTML. Learn what XHTML is, which browsers support application/xhtml+xml, key features, and how it differs from HTML.

Prince Dewani
May 6, 2026
XHTML is a W3C reformulation of HTML in XML that requires lowercase tags, quoted attributes, and closed elements. Served with the application/xhtml+xml MIME type, it works in Chrome 4+, Edge 12+, Firefox 2+, Safari 3.1+, Opera 9+, Internet Explorer 9+, Samsung Internet 4+, and Android Browser 2.1+, but not in IE 5.5 to 8.
This guide covers what XHTML is, browser support, the key features, differences from HTML, how to serve it correctly, and whether XHTML is still used.
XHTML, short for Extensible HyperText Markup Language, is a W3C specification that reformulates HTML as an XML application. It uses the namespace http://www.w3.org/1999/xhtml and enforces strict syntax rules: lowercase elements, quoted attribute values, and a closing tag for every opening tag. Browsers parse it as XML rather than as forgiving HTML.
Most modern browsers parse XHTML when the server sends it with the application/xhtml+xml MIME type. The exception is Internet Explorer 5.5 through 8, which prompts the user to download the file instead of rendering it.
Chrome supports XHTML from Chrome 4 on, on Windows, macOS, Linux, ChromeOS, and Android. Pages served with the application/xhtml+xml MIME type render in XML mode and stop rendering on the first parse error.
Microsoft Edge supports XHTML from Edge 12 on across Windows, macOS, and Linux. Edge inherits Chromium's XML parser, so behavior matches Chrome on every platform Edge ships on.
Firefox supports XHTML from Firefox 2 on across Windows, macOS, Linux, and Android. Mozilla's Gecko engine was one of the first to ship application/xhtml+xml and continues to render the markup in strict XML mode.
Safari supports XHTML from Safari 3.1 on macOS and from Safari 3.2 on iOS and iPadOS. The WebKit XML parser handles application/xhtml+xml the same way across iPhone, iPad, and Mac.
Opera supports XHTML from Opera 9 on the desktop and from Opera Mobile 10. After Opera moved to the Chromium engine, the same XML parser used by Chrome handles XHTML content in current Opera builds.
Samsung Internet supports XHTML from Samsung Internet 4 on Android. Built on Chromium, it parses application/xhtml+xml the same way Chrome does and applies the same fail-fast error handling.
The Android Browser supports XHTML from Android 2.1 on. Modern Android phones now use Chrome or a Chromium WebView, which inherits the same XML parsing behavior across the entire platform.
Internet Explorer supports XHTML only from IE 9 on Windows. IE 5.5 to IE 8 did not support application/xhtml+xml and instead prompted the user to save the response to disk. Microsoft has retired Internet Explorer, so the supported window is IE 9 to IE 11.
Note: XHTML behavior shifts across browsers and OS, especially on legacy IE and older Safari. Test it on real browsers and OS with TestMu AI. Try TestMu AI free!
XHTML keeps the element set of HTML 4 but tightens parsing in several ways:
XHTML is a stricter, XML-based form of HTML. The two languages share most elements but differ in syntax, parsing rules, and how browsers handle errors. The table below shows the practical differences a developer or QA engineer needs to know.
| Dimension | HTML | XHTML |
|---|---|---|
| Parser | HTML parser, lenient | XML parser, strict |
| Tag case | Mixed case allowed | Lowercase only |
| Attribute quotes | Optional in some cases | Mandatory on every value |
| Empty elements | br, img, hr | br /, img /, hr / |
| Error handling | Browser tries to recover | Stops on the first error |
| MIME type | text/html | application/xhtml+xml |
| Namespace | Not required | xmlns="http://www.w3.org/1999/xhtml" |
| document.write | Works | Throws an error |
XHTML is only XHTML when the server sends it with the right Content-Type header. Adding a DOCTYPE alone does not switch the browser into XML mode. Follow these steps to serve a page as true XHTML:
A minimal XHTML page that follows every rule looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta charset="UTF-8" />
<title>Sample XHTML Page</title>
</head>
<body>
<h1>Hello, XHTML</h1>
<p>Every tag is lowercased, quoted, and properly closed.</p>
<br />
<img src="logo.png" alt="Logo" />
</body>
</html>If the browser shows the source code as plain text or strips the XML declaration, the server is still sending text/html. Fix the Content-Type header before debugging anything else.
XHTML is not formally deprecated, but it has been overtaken by HTML5. The W3C halted XHTML 2.0 development and superseded the XHTML 1.0 Recommendation, pointing authors to the HTML Living Standard. XHTML5 lives on as the XML serialization of HTML5, so authors who want strict syntax can still write XHTML5 and serve it as application/xhtml+xml.
In my experience, most production sites send their pages as text/html now, even when the markup follows XHTML rules, because the HTML5 parser handles both styles without any server configuration. New projects should pick HTML5 unless an XML toolchain forces the XHTML5 serialization.
All XHTML version numbers, MIME type rules, and platform notes in this guide come from these primary sources:
Did you find this page helpful?
More Related Hubs
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance