# Fortran Wiki File extensions

The extensions .f90, .f95, and .f03 are used for modern, free-form source code conforming to the Fortran 90, Fortran 95, and Fortran 2003 standards. Some choose to use .f90 to denote any free-form source code, for example, including Fortran 2003 code.

For older, fixed-form code, such as FORTRAN 77, the .f or .for extensions are typically used.

Another convention, used by the GFortran compiler, is to use upper-case extensions to denote files which should be processed by the C preprocessor.

arjen (7 may 2009) Note that the Fortran standard itself does not define any extension, it does not even prescribe the use of files on disk to represent the source code. This may seem odd, but there are good reasons for this: a system might use a database of some sort to store all information in, so if the standard prescribed files on disk as the medium, it would exclude such systems.

What’s more, the concept of a file extension is ubiquitous on Windows platforms, but UNIX/Linux do not attach any special meaning to the last bit of a file name.

That said, the common conventions are: * .f, .for for fixed-form source code * .f90 for free-form source code * .F, .F90 (on UNIX/Linux) for fixed-form or free-form source code that must be preprocessed in a C-like style

Some recommend not using the .f95, .f03 file extensions (not to mention .f15). Not only are these extension not recognized by all compilers, but Fortran 95 or Fortran 2003 code can be written as fixed-form source (it’s still part of the standard). Use .f90 to indicate free-form source code. See: Source Form Just Wants to be Free