HTTP Content-Type Reference
Complete MIME types and media types reference
Filter by Category
Content Types
| Extension | MIME Type / Content-Type | Category | Description |
|---|
When to Use Content-Type Reference
API Development
Set correct Content-Type headers for REST APIs, GraphQL endpoints, and web services
File Uploads
Handle file uploads correctly by validating and setting appropriate MIME types
Server Configuration
Configure web servers (Apache, Nginx) to serve files with correct content types
Email Attachments
Set proper MIME types for email attachments to ensure correct handling by email clients
Web Development
Understand and implement correct content types for HTML, CSS, JavaScript, and other web resources
Debugging
Troubleshoot content type issues causing incorrect file rendering or download problems
Frequently Asked Questions
What is HTTP Content-Type?
HTTP Content-Type is a header field that indicates the media type (MIME type) of the resource being sent in an HTTP request or response. It tells the browser or client what type of data is being transmitted, such as text/html for HTML documents, image/jpeg for JPEG images, or application/json for JSON data. This helps the browser render the content correctly.
What is a MIME type?
MIME (Multipurpose Internet Mail Extensions) type is a standard way to indicate the nature and format of a file or data. It consists of a type and subtype separated by a slash (e.g., image/png, text/html, application/pdf). MIME types help applications determine how to process and display different types of content. They are essential for web development, email, and file handling.
How do I set Content-Type in HTTP headers?
To set Content-Type in HTTP headers, use the Content-Type header field. In PHP: header('Content-Type: application/json'); In Node.js: res.setHeader('Content-Type', 'text/html'); In HTML forms: <form enctype='multipart/form-data'>. The correct Content-Type ensures that browsers and clients properly interpret the data being sent or received.
What is the difference between text/plain and text/html?
text/plain is for plain text without any formatting or markup, displayed as-is by browsers. text/html is for HTML documents with tags, styles, and scripts that browsers parse and render. Use text/plain for simple text files or API responses that should be displayed without interpretation. Use text/html for web pages with HTML markup.
What Content-Type should I use for JSON?
For JSON data, use application/json as the Content-Type. This is the standard MIME type for JSON (JavaScript Object Notation) data. When sending JSON in API responses or requests, always set Content-Type: application/json to ensure proper parsing and handling by clients and servers. Some older systems may accept text/json, but application/json is the official standard.
What is multipart/form-data used for?
multipart/form-data is used for HTML forms that include file uploads. It allows sending multiple types of data (text fields and files) in a single HTTP request. Each part has its own Content-Type. Use this when forms contain file input fields: <form method='POST' enctype='multipart/form-data'>. For simple forms without files, use application/x-www-form-urlencoded instead.
How do I find the Content-Type for a file extension?
Use our Content-Type reference tool to search by file extension (e.g., .pdf, .mp4, .json). The tool displays the correct MIME type for each extension. Common examples: .jpg → image/jpeg, .png → image/png, .pdf → application/pdf, .mp4 → video/mp4, .json → application/json. You can also use server-side functions or consult MIME type databases.
Is this Content-Type reference free to use?
Yes, our HTTP Content-Type reference tool is completely free with no registration required. Search unlimited MIME types, browse by category, and access the complete reference without any costs or limitations. The tool includes over 100 common content types used in web development.
No comments yet. Be the first to share your thoughts!