lookup> .cpp

.CPP·File Extension

C++ Source FileC++ programming language source file.

Data & Texttext/x-c
Extension.cpp
File typeC++ Source File
MIME typetext/x-c
CategoryData & Text
Charset
Compressible
Format familycpp

What is a .cpp file?

A .cpp file is a C++ Source File — C++ programming language source file.

In the mime-db registry it maps to text/x-c. When serving .cpp over HTTP, set the Content-Type header as shown in Developer info below.

Related entities: it maps to text/x-c and is used by C++ among others — and is delivered over HTTP via the Content-Type header.

  • Use VS Code or Visual Studio to open and edit .cpp files.
  • Any text editor (Notepad, VS Code) can inspect the raw content as text.

When served over HTTP, responses should set the following header:

Content-Type: text/x-c

Common software that reads/writes .cpp:

VS CodeVisual StudioGCC
.cppextension of
format
cppserved as
mime type
text/x-csent via header
http header
  • Configuration files
  • Data interchange between systems
  • API request and response payloads
  • Logs and data exports
  • Open the file with VS Code, make your changes and save.
  • Most editors preserve the original formatting and encoding — avoid changing the charset.
  • Create a new file and save it with the .cpp extension, or export this format from VS Code.

What programs can open .cpp files?

Common options include VS Code, Visual Studio, GCC. You can also open many of these files with built-in viewers or a browser.

How do I create a .cpp file?

Create a new file in any text editor or the app that owns the format and save it with the .cpp extension.

What is the relationship between .cpp and the text/x-c MIME type?

text/x-c is the media type identifier used for .cpp files during network transfer (for example in the HTTP Content-Type header).

Updated 2026-08-18

Related extensions

Related MIME types

Related programming languages

Related headers

Related methods

Related status codes