Fortran is a compiled, statically typed programming language designed for numerical and scientific computing, with built-in support for multidimensional arrays, complex numbers and parallel execution. Among programming languages, it is the oldest high-level language still in wide professional use, and its name comes from Formula Translation.
Developed by a team at IBM led by John Backus and first released in 1957 for the IBM 704, Fortran proved that a compiler could produce code nearly as fast as hand-written assembly language. Today it is governed by ISO/IEC 1539 and remains central to weather forecasting, climate modeling, computational physics and engineering simulation.
How Fortran achieves high numerical performance
Fortran is fast mainly because its language rules give the compiler freedom to optimize. The standard forbids a procedure from modifying the same memory through two different dummy arguments, so compilers can assume no aliasing and vectorize loops aggressively, something a C compiler can do only when the programmer adds the restrict qualifier.
Arrays are first-class objects with shapes, bounds and whole-array operations. An expression such as c = a + b * 2.0 operates on entire arrays without explicit loops, and the compiler maps it onto SIMD instructions or parallel threads. Arrays are stored in column-major order and indexed from 1 by default, which matters when exchanging data with C or Python.
The table lists the language features that most influence performance.
| Feature | What it does | Performance effect |
|---|---|---|
| No-aliasing rule | Arguments do not overlap in memory | Enables aggressive vectorization |
| Array syntax | Whole-array and section operations | Maps directly to SIMD hardware |
| Pure and elemental procedures | Functions without side effects | Safe parallel execution |
| DO CONCURRENT | Loop with independent iterations | Allows automatic parallelization |
| Coarrays | Distributed arrays across images | Parallel computing without external libraries |
Fortran standards from FORTRAN 66 to Fortran 2023
Fortran has evolved through a series of formal standards, each largely backward compatible. The spelling changed from FORTRAN to Fortran with the 1990 standard, which also marked the shift from punched-card layout to modern structured programming.
| Standard | Key additions | Practical significance |
|---|---|---|
| FORTRAN 66 | First ANSI standard | Portable code across vendors |
| FORTRAN 77 | Character type, block IF | Dominant legacy dialect |
| Fortran 90 | Free-form source, modules, array syntax, allocatable arrays | Foundation of modern Fortran |
| Fortran 95 | Pure and elemental procedures | Cleaner parallel semantics |
| Fortran 2003 | Object-oriented features, C interoperability | Mixed-language projects |
| Fortran 2008 | Coarrays, DO CONCURRENT, submodules | Native parallel programming |
| Fortran 2018 and 2023 | Teams, events, further C integration | Incremental refinement |
A frequent misconception equates Fortran with fixed-form FORTRAN 77 code. Modern Fortran supports modules, derived types, generic interfaces, polymorphism and standardized interoperability with C through the iso_c_binding module.
Fortran compared with C, C++, Python and MATLAB
Fortran occupies a narrow but deep niche: dense numerical computation where runtime and memory efficiency dominate. The comparison shows where it fits among related languages.
| Language | Execution model | Strength in numerics | Typical role |
|---|---|---|---|
| Fortran | Compiled to native code | Native arrays and strong optimization | Simulation kernels |
| C | Compiled to native code | Low-level control, aliasing limits | Systems and libraries |
| C++ | Compiled to native code | Templates and expression libraries | Large frameworks |
| Python | Interpreted | Fast only through compiled libraries | Workflow and analysis |
| MATLAB | Interpreted with JIT | Concise matrix notation | Prototyping and teaching |
These languages often work together. NumPy and SciPy call Fortran routines from BLAS and LAPACK, the reference linear algebra libraries, and tools such as f2py expose Fortran subroutines directly to Python.
The usual division of labor is therefore pragmatic rather than competitive. Teams prototype and orchestrate in Python or MATLAB, then move the hot loops into Fortran or C++ once profiling shows where time is spent. Rewriting a validated Fortran solver in another language is expensive and risky, because every numerical result must be revalidated against decades of reference cases, so many institutions instead wrap existing Fortran code behind modern interfaces.
Compilers, tools and where Fortran is used
Fortran is supported by actively maintained compilers, including GNU gfortran, Intel ifx, LLVM Flang, NVIDIA nvfortran with GPU offloading, and vendor compilers for supercomputers. Parallelism is added through coarrays, OpenMP directives for shared memory and MPI for distributed clusters.
- Numerical weather prediction and global climate models run large Fortran code bases on supercomputers.
- Computational fluid dynamics and structural analysis solvers rely on Fortran kernels.
- Quantum chemistry and materials science packages are often written mainly in Fortran.
- High-performance computing benchmarks and national laboratory codes keep Fortran in active development.
Modern tooling includes the Fortran Package Manager (fpm), the community-developed standard library project stdlib, and language servers for code editors.
Limitations and common pitfalls
Fortran is poorly suited to general-purpose application development. Its string handling, user interface options and web ecosystem are weak compared with Python, Java or JavaScript, and the pool of experienced developers is smaller.
| Pitfall | Consequence | Remedy |
|---|---|---|
Missing implicit none | Typos create new variables silently | Declare it in every scope |
| Looping over rows first | Poor cache use in column-major arrays | Vary the first index fastest |
| Default real precision | Single precision rounding errors | Use kind parameters such as real64 |
| Legacy COMMON blocks | Hidden global state | Replace with module variables |
| Mismatched C array layout | Transposed or corrupted data | Account for column-major order |
Maintaining legacy code is the most demanding challenge. Old programs may rely on nonstandard extensions or obsolete constructs, so modernization should proceed incrementally with regression tests that compare numerical results against trusted outputs.
Put simply
Fortran is one of the first programming languages ever created, and it was built for one job: doing large amounts of math very quickly. Scientists use it to tell computers how to predict the weather, simulate air flowing over a wing or model how molecules behave.
It is like a specialized racing car rather than a family vehicle. It is not convenient for everyday tasks such as building websites, but on the numerical racetrack it remains among the fastest.
In practice
A national meteorological service runs a regional weather forecast four times a day on a supercomputer. The atmospheric model, roughly a million lines of modern Fortran, divides the country into a grid of 2.5-kilometer cells and solves the equations of fluid motion for each cell.
The code uses MPI to split the grid across thousands of processor cores and OpenMP within each node. Engineers recently added GPU offloading for the radiation scheme, cutting the runtime of that component by about 60 percent.
The result is a 48-hour forecast delivered within the operational time window of about one hour, while a Python workflow handles data ingestion and the charts published to forecasters.