Aarunya AppsAarunya Apps
text/html

text/html MIME Type — HTML Content-Type & Server Configuration

HyperText Markup Language. The foundation of the web — the format browsers use to render web pages. Returned by web servers for all HTML pages and is the default type for browser navigation.

Type
text
Charset
UTF-8
Compressible
Yes (gzip/br)
Extensions
.html .htm

Used For

  • Web pages served by HTTP servers
  • Email HTML templates (multipart/alternative)
  • Server-side rendered pages

HTTP Header Example

HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Cache-Control: no-cache

<!DOCTYPE html>
<html lang="en"><head>...</head><body>...</body></html>

Code Examples

// Express — send HTML string
app.get('/', (req, res) => {
  res.set('Content-Type', 'text/html; charset=utf-8').send(
    '<!DOCTYPE html><html><body><h1>Hello</h1></body></html>'
  )
})

// Or use res.sendFile for static HTML
app.get('/about', (req, res) => res.sendFile('about.html', { root: './public' }))

// Next.js — page components return text/html automatically
// No manual Content-Type needed

Related MIME Types

All MIME Types

Browse the complete MIME type reference.

View All MIME Types

Frequently Asked Questions

What is the text/html MIME type?

HyperText Markup Language. The foundation of the web — the format browsers use to render web pages. Returned by web servers for all HTML pages and is the default type for browser navigation.

When should I set Content-Type: text/html?

Set Content-Type: text/html on HTTP responses that contain HTML data. Web pages served by HTTP servers.

What file extensions use text/html?

Files with text/html content typically use these extensions: .html, .htm.

What happens if I serve this with the wrong Content-Type?

Browsers use the Content-Type header to decide how to handle the response. Serving text/html content with an incorrect MIME type can cause browsers to display it incorrectly, refuse to execute it (scripts), or prompt an unintended download. Modern browsers respect X-Content-Type-Options: nosniff and will not attempt to auto-detect the type.