If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

File types

Computers store all files as binary data, long strings of 1s and 0s. Files represent all different types of data, however—like images, videos, documents, text files, and spreadsheets. Even applications are files.
How does a computer know that one chunk of data is an image, and another chunk is a spreadsheet?
Each file has a type/kind/format, which is often reflected in its file extension. For example, "students.csv" is a "CSV Document" and has the extension "csv".
🔍 Browse around your desktop now and see what kind of files you have. If you can't see the file extensions, your computer may be setup to hide extensions by default. You can often turn extensions back on in settings. Just do a search online for "Show extensions on [your computer type]".

Detecting file types

Files don't always have an extension, and sometimes an extension doesn't reflect the actual file format. In that case, computers can try a number of techniques to figure out the file type, so that it can open that file in the most appropriate program.
One way to detect the file format is to look for clues inside the file data itself. Many file types start with a "file header" with metadata.
For example, a GIF file always starts with the letters "GIF", encoded in binary according to the ASCII standard:
0100 0111 0100 1001 0100 0110
If a computer sees that sequence of binary data, it has a high confidence that the file is a GIF and can send it to an image viewing application. The application can either successfully read and display the pixels, or let the user know that the file isn't a valid image file.

Exploring file types

Our computers load many different types of files every day. You might already be familiar with many of those file types, but you might also discover exotic new file types in your journey into computer science.
🔍 Discover more file types in the upcoming exercises. Never heard of a file? Just search for more information online with a query like "svg file format".
Open file formats
The following table lists the extensions of four "open formats", file formats that can be used by anyone.
Match each extension to an example of data that it can store:

Website file formats
The following table lists the extensions of file formats used by the Khan Academy website.
Match each extension to an example of how we use that format on the website:

🙋🏽🙋🏻‍♀️🙋🏿‍♂️Do you have any questions about this topic? We'd love to answer— just ask in the questions area below!

Want to join the conversation?