The <xmp> element once rendered the text between its start and end tags without interpreting HTML inside, typically in a monospace font. Older specs even suggested room for about 80 characters per line.
Do not use it. Prefer <pre> for blocks or <code> when the sample is computer code. Escape < and & so browsers do not treat them as markup. Related obsolete tags: <plaintext> and <listing>.
Deprecated · Obsolete.
Deprecated since HTML 3.2 and removed from current HTML. Never consistent across browsers. Avoid in every new project.
Study-only examples.
Legacy snippets exist so you can recognize old markup. Prefer the pre / code versions in real work.
Syntax
HTML Syntax
syntax.html
<xmp>raw example text</xmp>
Historical form only — start and end tags, content shown as literal text. Prefer this modern equivalent:
prefer.html
<pre><code><p>Hello</p></code></pre>
Reference
Attributes
<xmp> had no element-specific attributes — only globals historically. Put those attributes on modern replacements instead:
Paste the sample; escape < / > / & when the sample is HTML.
Close both tags so the rest of the page stays normal HTML.
Edge Cases & Pitfalls
Most xmp problems come from copying historical raw-text behavior into modern pages.
obsolete
Removed from current HTML
Deprecated since HTML 3.2 and not part of modern HTML. Never build new UI on it.
escape
Escape in pre/code
To show HTML as text, use <, >, and &. Do not rely on a raw-text element.
compat
Never consistent
Engines differed historically and may remap the element today. Treat any remaining support as accidental.
related
Also obsolete: plaintext, listing
Similar historical raw-text ideas. Prefer pre / code for all of them. See also HTML deprecated tags.
css
Monospace is a style choice
Want a fixed-width look? Use CSS font-family: monospace on a modern element — not an obsolete tag.
Compatibility
Browser Support
The <xmp> element is legacy HTML. It is not a Node.js, Deno, or Bun API.
✓ Deprecated · Obsolete
<xmp>
Removed from current HTML. Some browsers may still map it toward pre-like rendering. Prefer pre and code with escaped characters.
—Do not use in new work
Google ChromeLegacy
Non-standard / remapped
Mozilla FirefoxLegacy
Non-standard / remapped
Apple SafariLegacy
Non-standard / remapped
Microsoft EdgeLegacy
Non-standard / remapped
OperaLegacy
Non-standard / remapped
Samsung InternetLegacy
Non-standard / remapped
Internet ExplorerLegacy
Historical
<xmp>Obsolete (use pre/code)
Bottom line: Recognize xmp in very old markup, then replace it with pre/code. Never ship new pages that depend on it.
Remember
Key Takeaways
Status:<xmp> is obsolete — avoid in new HTML.
History: showed content as literal text (often monospace) without parsing inner HTML.
Replace with:pre, code, and escaped < / &.
Family: also skip obsolete plaintext and listing.
One line: recognize <xmp> in old pages; show text samples with pre/code.
UA style
Default CSS Settings
There is no modern standard stylesheet for <xmp>. Engines that still remap it often behave like pre:
prefer.css
/* Prefer styling modern elements */
pre, code {
font-family: monospace;
}
pre {
white-space: pre;
}
Apply font-family: monospace with CSS when you want a fixed-width look — not via obsolete tags.
Frequently Asked Questions
Historically, xmp showed the text between its start and end tags without interpreting HTML inside, usually in a monospace font. It is obsolete.
No. It has been deprecated since HTML 3.2 and was removed from current HTML. Do not use it in new projects.
Use pre for preformatted blocks, or code when the sample is computer code. Escape < as < and & as & so browsers do not treat them as markup.
xmp wrapped content between start and end tags. plaintext historically had no end tag and treated everything after it as raw text. Both are obsolete; prefer pre/code.
Support was never consistent. Some engines may treat it like a pre-like block. Do not rely on it.
Put the sample in pre or code and escape characters: < for <, > for >, and & for &.