File Formats

Published May 27, 2022Updated Nov 28, 2022
Contribute to Docs

File formats determine how information or data, such as text and images, are created, stored, and read. Each file format has a unique extension. For example, a CSV (Comma Separated Values) file has the extension .csv. The terms “file format” and “file type” are often used interchangeably.

Certain formats are designed to compress data for fast processing. Others may contain more features, like how XLSX (Microsoft Excel) files can contain graphs and charts along with table data, whereas a CSV file can only contain plain table data.

Files can also be converted to other formats, however, some features for data display may be lost depending on the type of conversion.

Types of File Formats

File formats exist for different types of files. Some common file formats are listed below:

Programming File Formats

File Format Extension Description
C .c Contains a C program.
C++ .cpp Contains a C++ program.
CSS (Cascading Style Sheets) .css Contains the styling for an HTML page.
Go .go Contains a Go program.
HTML (HyperText Markup Language) .html Contains an HTML web page.
Java .java Contains a Java program.
JS (JavaScript) .js Contains a JavaScript program.
PHP (Hypertext Preprocessor) .php Contains a PHP program.
Python .py Contains a Python program.
R .r Contains an R program.
Ruby .rb Contains a Ruby program.
SQL (Structured Query Language) .sql Contains an SQL program.
Swift .swift Contains a Swift program.
TS (TypeScript) .ts Contains a Typescript program.

Image File Formats

File Format Extension Description
JPEG (Joint Photographic Experts Group) .jpeg Standard use for minimized images.
PNG (Portable Network Graphics) .png Common file format for high resolution images.
SVG (Scalable Vector Graphics) .svg Great for responsive design. Used for images that can be scaled up or down on a page without losing quality.

Other File Formats

File Format Extension Description
CSV (Comma-separated Values) .csv Contains spreadsheet/table data.
Executable .exe Contains an executable.
MD (Markdown) .md Contains easily readable markup.
PDF (Portable Document Format) .pdf Created to be accessed on many devices and operating systems. Contains text and image data.
TXT (Text) .txt Contains text.
Zip .zip Compresses files into a folder that can be uncompressed into its original form.

All contributors

Looking to contribute?

Learn More on Codecademy