File Formats
A file format is the way data is stored inside a file. Two files might hold the same song or picture but arrange the data completely differently, and each arrangement is a different format. The file extension is the short tag at the end of a file name, after the full stop, which shows which format that file uses.
Extensions exist so software can recognise a file without having to guess. When you double-click match_highlights.mp4 your computer reads mp4 and hands the file to a video player; open shopping_list.txt instead and a text editor launches. The extension is only a label that points to the format — it does not hold the content itself.
Extensions are usually three or four letters, often lower case: .png, .mp3, .docx. A file name can contain more than one full stop, so software always looks at the part after the last one. In trip.2025.jpg the format is jpg, and the earlier full stop is just part of the name. Some formats also use a longer version, such as .jpeg or .mpeg, which the same software still recognises.
Renaming a file does not convert it. Change cookbook.docx to cookbook.pdf and the computer will happily try to open it as a PDF, but the data inside is still in DOCX, so the file either refuses to open or appears scrambled. That is why the extension must always match the format the file was actually saved in — a correct match is what gets the right software to open it.
filename = "book_report.docx"
extension = filename.rsplit(".", 1)[1]
opening_software = {"docx": "word processor", "png": "image viewer", "mp3": "music player"}
print("Extension:", extension)
print("Open with:", opening_software.get(extension, "app not found"))Output:
Extension: docx
Open with: word processor OCR Creative iMedia · File Formats