Home Software Development Guide Programming Concepts File Extensions

File Extensions

by wforbes

(Part 5 of my Programming Concepts series)

File extensions are the letters after the dot in computer file names. For instance, you may have a text document you’ve named “GroceryList” and so the full file name would be “GroceryList.txt”. That last part of the file name, the ‘.txt‘ is the file extension. When you open and save a document in a word processor (like Microsoft Word, OpenOffice Writer, WPS Office Writer, TextEditor, Wordpad, or Notepad), you’re creating a text document (or a text file). These documents have file extensions like “.txt”, “.doc”, “.docx”, “.rtf”, “.odt” or something like that. These extensions are abbreviations that indicate the file type, (or the file format) which tells the computer how it should interpret and open these files. When you try to open a “.docx” file, your computer may already know it should use Microsoft Word, or when you open a “.txt” file it may use Notepad.

When it comes to source code files, the file extension is usually directly related to the programming language it is written in. Source code files written for the Java programming language, which has Java source code in them, have the “.java” extension. C source code has the “.c” extension, C++ source code has the “.cpp” extension, C# source code has the “.cs” extension, Python source code has the “.py” extension, and so on. Markup files written in HTML or XML have the “.html” or “.xml” extensions. Source code written in a scripting language like PHP, Javascript or SQL have the extensions “.php”, “.js” and “.sql”, respectively.

You can find full exhaustive lists of these file extensions online with a quick Google search, or more specific lists of programming related file extensions with a little more digging. Though, normally a programmer will only really need to remember a handful of these when working on a given project or programming discipline. Often, the tools that programmers use to create source code will automatically recognize and include the file extension to save them appropriately for the programmer. Still, it’s very important for the programmer to be generally aware of the different types of source code and other files they may work with and their associated file extensions.

Next we’ll explore some general ideas about what Programming Languages are and touch on the idea of Syntax…

Continue to Part 6 “Programming Languages and Their Syntax” >