Log in Sign up
Back to Discover
💻

File format

technology Maturity 11-13

Computers use files to save things.

Bass loop 1 (Carrai Pass).wav
Bass loop 1 (Carrai Pass).wav
A file tells the computer what it is. It can be a song or a picture. This helps the computer work fast. It is like a label on a box. Do you like to look at pictures on a screen?

51 words

Computers save many things in files.

Bass loop 1 (Carrai Pass).wav
Bass loop 1 (Carrai Pass).wav
A file format is a way to organize that data. It is like a set of rules for a file. Some files hold just one thing, like a picture.
Boogie riff 1.ogg
Boogie riff 1.ogg
Other files can hold many things. One file might hold music and video together. You can find the file type by looking at the end of its name. These short names are called extensions. They help your computer know how to open the file. This makes everything work well.

92 words

Computers store many kinds of data in files. A file format is the way that data is organized. It acts like a set of rules for the file.

Bass loop 1 (Carrai Pass).wav
Bass loop 1 (Carrai Pass).wav

Some formats are made for just one thing. For example, PNG files store pictures. Other formats are like containers. The Ogg format can hold audio and video together. It can even hold text like subtitles.

Boogie riff 1.ogg
Boogie riff 1.ogg

How do we know a file's format? One way is to look at the file name. Many systems use an extension. This is a short label at the end of a name. An HTML file ends in .html. A GIF image ends in .gif.

Computers can also look inside the file. They may find a file header. This is a part at the start of the file. It holds metadata, which is extra info about the file. A header might show the file size or color. Some files even have a magic number. This is a small piece of data used to identify the format. It helps the computer know if a file is correct.

186 words

A computer file is not just a pile of data. It needs a specific way to be organized so the computer can understand it. This way of organizing information is called a file format.

Bass loop 1 (Carrai Pass).wav
Bass loop 1 (Carrai Pass).wav
Some formats are very simple and only hold one type of thing. For example, a PNG file is used to store bitmapped images. Other formats work like a container. The Ogg format can hold many different types of data at once. It can hold audio, video, and even text like subtitles.
Boogie riff 1.ogg
Boogie riff 1.ogg
This makes it very useful for multimedia.

To make these files work, there must be a set of rules. These rules are often found in a document called a specification. This document explains exactly how the data should look. Not every format has a public specification. Some companies keep their rules a secret to protect their ideas. Other times, a developer has to use reverse engineering to figure it out. They do this by carefully inspecting the files to see how they work. This can take a lot of time and money. Because of this, formats with public rules are usually supported by more programs.

Sometimes, the rules for a format are protected by law. This is often done using patent law. A patent can protect a special way that a file shrinks data, which is called an algorithm. For example, the GIF format used a patented algorithm for a long time. Before 2004, people had to pay royalty fees to use it. This caused many people to stop using GIFs. Instead, they started using the PNG format. The GIF patent eventually expired in the US in mid-2003. It expired worldwide in mid-2004.

How does a computer know which format to use? One common way is by looking at the file extension. This is a short suffix at the end of a filename. For instance, an HTML file ends with .html. A GIF image ends with .gif. Many systems like Windows and macOS use this method. In the old FAT file system, names were very short. They used an 8.3 naming scheme with only eight characters for the name. Today, we use longer extensions, but many still use three letters. This can sometimes confuse people or computers if two formats use the same short label.

Computers can also look inside the file to find its identity. They might look for a file header at the very beginning. This header contains metadata, which is extra information about the file. It might tell the computer the size or the color of an image. Some files even have a magic number. This is a small piece of data that uniquely identifies the format. For example, a GIF file always starts with specific letters. This helps the computer check if the file is correct or broken.

Bass loop 1 (Carrai Pass).wav
Bass loop 1 (Carrai Pass).wav
Boogie riff 1.ogg
Boogie riff 1.ogg

483 words

A file format is a specific method for encoding information so it can be stored in a computer file. It provides the rules for how data is organized. These rules can exist at many levels of abstraction. At a low level, a format describes the layout of bits and bytes. At a high level, it describes the organization of data, such as markup or tabular structures. Understanding file formats is essential because it allows different software programs to read and use the same information. Without these rules, a computer would just see a meaningless stream of data.

Bass loop 1 (Carrai Pass).wav
Bass loop 1 (Carrai Pass).wav

File formats function through various mechanisms to store different types of data. Some formats are designed for very specific purposes. For example, PNG files use lossless data compression to store bitmapped images. This means the image data is shrunk without losing any quality. Other formats act as containers for multiple types of data. The Ogg format is a great example of this. It can hold a combination of audio and video. It can also include text, such as subtitles, and metadata. Metadata is extra information about the data itself. Text files are another type, as they can contain streams of characters. These characters are organized using specific character encoding schemes.

There are different types of file formats based on how they are defined. Some are standardized, meaning the rules are official. These can be proprietary, owned by a company, or open for anyone to use. Other formats are ad hoc conventions, which are less formal. Some formats are text-based, like HTML or scalable vector graphics. These use defined syntaxes to perform specific tasks. Other formats are binary, which are not easily read by humans. Some formats even use a wrapper structure to manage complex data types within a single file.

To ensure compatibility, many formats have a published specification. A specification is a document that describes the format in detail. It may even explain how to verify if the data is correct. However, not all formats have these documents available. Some companies treat their formats as trade secrets to protect their intellectual property. In other cases, a document simply was never written. When no specification exists, developers may use reverse engineering. This involves inspecting files to figure out how they work. Developers might also pay a fee to see a specification under a non-disclosure agreement. Formats with public specifications are generally supported by more programs.

Boogie riff 1.ogg
Boogie riff 1.ogg

Intellectual property protection is a significant part of the history of file formats. Patent law is often used to protect the algorithms within a format. A famous example involves the GIF file format. Before 2004, using certain compression in a GIF required a patented algorithm. The patent owner eventually began collecting royalty fees. This caused a significant decrease in GIF usage. It also helped lead to the development of the PNG format as an alternative. The GIF patent expired in the United States in mid-2003. It expired worldwide in mid-2004.

Operating systems use several methods to identify a file's format. One popular method is the filename extension. This is a suffix at the end of a filename, such as .html or .gif. Many systems, including Windows and macOS, use this method. In the old FAT file system, names followed an 8.3 rule. This meant names had eight characters and extensions had only three. Because of this history, many modern extensions are still only three letters long. This can cause confusion if different formats use the same extension. It can also be a security risk. A malicious user could name a program "image.jpg.exe." If the system hides extensions, the user only sees "image.jpg."

Bass loop 1 (Carrai Pass).wav
Bass loop 1 (Carrai Pass).wav

Another method of identification is through internal metadata. A file might contain a file header at the beginning. This header provides information like the file's size, resolution, or color space. Some files also use a magic number for identification. A magic number is a small piece of data that uniquely identifies the format. For example, GIF images always start with the characters GIF87a or GIF89a. HTML files might start with the string <html. Using magic numbers is very reliable. Even if a user changes a filename, the magic number remains the same. This allows a program to verify if a file is truly the correct type or if it is corrupt.

728 words
🖼️ Images & Media (2)
Bass loop 1 (Carrai Pass).wav
Boogie riff 1.ogg
Up Next
💻
Binary file
Technology
More to explore

🔬 Go deeper

More advanced topics to explore

🪜 Step back

Simpler topics to build understanding

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.