.XHTML

XHTML File

Extensible HyperText Markup Language Document
Ask a question
QUICK ANSWER

An XHTML file is a web page written in XHTML - HTML expressed using strict XML syntax (lowercase tags, every tag closed, all attributes quoted). Double-click it to view in any browser (Chrome, Edge, Firefox, Safari). To edit the code, open it in VS Code or Notepad++. The file is plain text and safe to open in a text editor.

Developer: W3C (XHTML 1.0/1.1/2.0); reformulation of HTML as XML Category: Web Files Open standard MIME: application/xhtml+xml
OPENS ON Windows macOS Linux Android iOS Web

On this page

19k+ extensions indexed
Last reviewed Jul 27, 2026

Not sure what your file is?

Drop any file into our identifier - we read just the first bytes to name the format.

Identify a file

What is the XHTML file format?

.xhtml files hold web pages written to the XHTML syntax - an XML-based reformulation of HTML standardized by the W3C in January 2000. XHTML is essentially an enhanced, stricter version of HTML 4, offering the same approach to writing web pages but under tighter XML rules.

The .xhtml format uses the same tags as HTML, but .xhtml pages must conform to stricter XML guidelines. Specifically, .xhtml documents must be well-formed: all tags lowercase, every attribute value quoted, every element explicitly closed (e.g. <br /> not <br>), and the whole document rooted at a single <html xmlns="http://www.w3.org/1999/xhtml"> element. They are parsed using strict XML parsers rather than the more forgiving HTML-specific parsers used for ordinary .html files - a single malformed tag halts rendering entirely when served as application/xhtml+xml.

XHTML 1.0 (2000) and 1.1 (2001) have largely given way to HTML5 for new web development, but XHTML5 - the XML serialization of HTML5 - survives. XHTML also remains the required content format for chapter documents inside EPUB e-books.

Security & safety

RISK: LOW

An .xhtml file is plain text and safe to open in a text editor. As with any web page, it can embed JavaScript that runs when opened in a browser, so a malicious local .xhtml could host a phishing page (a fake login form) or run scripts. Treat .xhtml files from e-mail or untrusted downloads like any web page: don't enter credentials into an unexpected page, and inspect a suspicious file in a text editor before letting a browser execute it.

Format details

in a nutshell
FULL NAMEExtensible HyperText Markup Language Documentaka XHTML file, XHTML web page
DEVELOPERW3C (XHTML 1.0/1.1/2.0); reformulation of HTML as XMLsince 2000 (XHTML 1.0, W3C Recommendation)
CATEGORYWeb Files
MIME TYPEapplication/xhtml+xml
TYPEPlain-text markup document (HTML written to XML syntax rules)
STANDARDOpen · royalty-free
This extension is also used by…
  • EPUB content document - Inside an .epub e-book the individual chapter/page files are XHTML, though they usually carry the .xhtml extension within the ZIP rather than appearing loose on disk.

Programs that open XHTML files

Windows4 apps
Mozilla Firefox Free Drag the file into Firefox to render it; if served as XML, a single markup error shows a parse-error page (a useful validity check).
Notepad Open-source Open to view/edit the source with syntax highlighting; the XML Tools plugin checks well-formedness.
Microsoft Edge / Google Chrome Built-in Double-click the .xhtml to view it rendered. Edge is the built-in default browser on Windows 11.
Visual Studio Code Free Open the .xhtml to edit the markup with XML/HTML highlighting; the Live Preview extension renders it.
macOS3 apps
TextEdit Built-in Format > Make Plain Text, then edit the raw XHTML.
Safari Built-in Double-click to render the page in Safari, the built-in macOS browser.
Visual Studio Code Free Open the file to edit the source; preview with the Live Preview/Live Server extension.
Linux2 apps
Firefox / Chromium Open-source Double-click to render the page in your browser.
gedit / any text editor Open-source Open the file to view and edit the XHTML source.
Android1 app
Chrome / any browser Free Open the .xhtml via Files/Chrome to render it; use a code-editor app to edit the source.
iOS1 app
Safari / any browser Built-in Open the .xhtml in Safari (or via Files) to render it; use a code-editor app to edit.
Web1 app
W3C Markup Validator Free Upload the .xhtml to check it is well-formed and valid against its DTD - the most useful XHTML-specific tool.

Technical details

deep spec
MIME typeapplication/xhtml+xml (strict XML parsing); also served as text/html (lenient HTML parsing)
File encodingUTF-8 (XML default); declared in the XML declaration <?xml encoding="UTF-8"?> or HTTP Content-Type header
XML conformanceMust be well-formed XML: lowercase tags, all attributes quoted, every element closed, single root element
NamespaceRoot <html> element requires xmlns="http://www.w3.org/1999/xhtml" declaration
DOCTYPE variantsXHTML 1.0 Strict, Transitional or Frameset DTDs; XHTML 1.1 (modularized); XHTML5 (HTML5 XML serialization)
Error handlingServed as application/xhtml+xml: a parse error produces a blank page; served as text/html: lenient fallback
EPUB usageXHTML is the mandated content format for chapter documents inside EPUB e-books
ContainerPlain-text XML document; no binary or ZIP wrapper
Typical file sizeA few KB to a few hundred KB (CSS, JS and media are referenced externally, not embedded)
Void elementsSelf-closing syntax required for void elements (e.g. <br />, <img />, <link />)
W3C historyXHTML 1.0 Recommendation: January 2000; XHTML 2.0 development abandoned 2009 in favour of HTML5
XML declarationOptional <?xml version="1.0" encoding="UTF-8"?> prolog; a UTF-8 BOM (EF BB BF) may precede it
ValidationW3C Markup Validator can validate .xhtml documents against their declared DTD
Released2000 (XHTML 1.0, W3C Recommendation)
Latest versionXHTML5 (the XML serialization of HTML5, part of the WHATWG HTML Living Standard); XHTML 1.1 (2001) is the last standalone W3C version
Open standardYes · royalty-free
Specificationwww.w3.org

XHTML conversions

Community Q&A

asked by users
Ask a quick question
Get help from people who work with XHTML files. Be specific - include your system and software version.
No account needed · answers usually within a day

No questions yet - be the first to ask about XHTML files.

Frequently asked questions

How do I open an .xhtml file?
To view it, double-click - it opens in your default web browser (Edge, Chrome, Firefox, Safari) and renders like a normal web page. To edit the code, open it in a text/code editor such as VS Code or Notepad++.
What is the difference between XHTML and HTML?
They share the same content and render the same. XHTML is HTML written to strict XML rules - lowercase tags, every tag closed (<br />), attributes always quoted, one root element, proper nesting. HTML allows looser syntax. The practical difference is which parser the browser uses based on the MIME type.
Can I just rename an .xhtml to .html?
Usually yes - the content is the same and browsers parse it leniently as text/html. For a tidy result run HTML Tidy to convert it cleanly. Going the other way (HTML to valid XHTML) needs cleanup because HTML is often not well-formed XML.
Why does my .xhtml show a parse error or blank 'not well-formed' page?
When served as application/xhtml+xml, the browser uses a strict XML parser that aborts on the first well-formedness error (an unclosed tag, an unquoted attribute, mismatched nesting). Open it in a text editor or the W3C Validator to find and fix the offending markup.
How do I convert an .xhtml to PDF?
Open the .xhtml in a browser, press Ctrl+P (Cmd+P on Mac) and choose 'Save as PDF'. This saves the rendered page as a PDF.
Why are the chapters of my EPUB e-book .xhtml files?
EPUB is essentially zipped XHTML + CSS, so each chapter/page inside the book is stored as an XHTML document. If you unpack an .epub you'll see these .xhtml files - they're the actual readable content.

References

1W3C - XHTML 1.0 (Second Edition) Recommendationwww.w3.org
2W3C Markup Validation Servicevalidator.w3.org

Keep exploring

across the database

Top extensions this week

1.AQQAQQ Instant Messenger File
2.CRDOWNLOADChrome Partial Download File
3.DATProgram Data File (generic)
4.PARTPartial Download File
5.RPMSGRestricted Permission Message
6.EXEWindows Executable (Portable Executable)
7.BINCD/DVD Disc Image (BIN/CUE)
8.DLLDynamic Link Library
9.M4AMPEG-4 Audio File
10.JPGJPEG Image

Related extensions

.CRDOWNLOADChrome Partial Download File
.JNLPJava Network Launch Protocol file
.WEBARCHIVESafari Web Archive
.PARTPartial Download File
.DOWNLOADPartial / Incomplete Download File
.ASPXActive Server Page Extended (ASP.NET Web Form)

Free file tools

An in-browser file identifier and image converter - everything runs on your device.

Open the toolbox

Browse file extensions A-Z