TextText-based

text/xml

XML (Text)

Reference for text/xml, the text-oriented MIME type for XML documents suitable for human-readable XML content.

MIME Type Detector

Drop a file to detect its MIME type — no upload, runs in your browser

📄

Drop any file here or click to choose

Expected extensions: .xml

HTTP Content-Type Header

HTTP Header
Content-Type: text/xml; charset=utf-8

Associated File Extensions

.xml

Quick Facts

MIME Typetext/xml
CategoryText
TypeText-based (human-readable)
Extensions.xml

Common Usage

text/xml is used when XML content is primarily human-readable, as opposed to application/xml which is preferred for machine-processed XML. Both are valid for XML documents, but text/xml defaults to us-ascii encoding while application/xml defaults to UTF-8.

Code Examples

HTML
<!-- Link or embed with explicit type -->
<link rel="stylesheet" href="file.xml" type="text/xml">

<!-- Or for script/media elements -->
<script type="text/xml" src="file.xml"></script>
Node.js
// Express.js
app.get('/file', (req, res) => {
  res.type('text/xml');
  res.send(data);
});

// Node.js http
res.writeHead(200, { 'Content-Type': 'text/xml' });
nginx
# nginx.conf — add to types block or use default
types {
    text/xml  xml;
}

# Or set for a specific location
location /api/ {
    default_type text/xml;
}

Related MIME Types

More Text MIME Types

Other text types in the Text family

Related Tools

Explore More MIME Types

Browse our complete reference of 185 MIME types with usage examples, HTTP headers, and code snippets.