TextText-based
text/x-c
C/C++ Source
Reference for text/x-c, the MIME type for C and C++ programming language source code files.
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: .c, .h, .cpp, .hpp, .cc, .hh
HTTP Content-Type Header
HTTP Header
Content-Type: text/x-c; charset=utf-8Associated File Extensions
.c.h.cpp.hpp.cc.hh
Quick Facts
| MIME Type | text/x-c |
| Category | Text |
| Type | Text-based (human-readable) |
| Extensions | .c, .h, .cpp, .hpp, .cc, .hh |
Common Usage
C and C++ source files are used for operating systems, embedded systems, game engines, compilers, databases, and performance-critical applications. C is the language of Linux, Windows, and macOS kernels.
C++ powers Unreal Engine, Chrome, and most desktop applications.
Code Examples
HTML
<!-- Link or embed with explicit type -->
<link rel="stylesheet" href="file.c" type="text/x-c">
<!-- Or for script/media elements -->
<script type="text/x-c" src="file.c"></script>Node.js
// Express.js
app.get('/file', (req, res) => {
res.type('text/x-c');
res.send(data);
});
// Node.js http
res.writeHead(200, { 'Content-Type': 'text/x-c' });nginx
# nginx.conf — add to types block or use default
types {
text/x-c c h cpp hpp cc hh;
}
# Or set for a specific location
location /api/ {
default_type text/x-c;
}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.