XCODX |

Fortran Online Compiler & Interpreter

Select Language
Online Code Compiler
Full HTML IDE
Py main.py
Program Output Ready
  Welcome to XCODX Online Compiler

  Quick Start:
  Ctrl+Enter  Run code
  Ctrl+S      Save / Download
  Ctrl+L      Clear output

  Select a language and start coding.
Success
Operation completed

About Fortran

The world's fastest supercomputers still spend enormous cycles executing Fortran. Born at IBM in 1957 as the first widely used high-level language, it never stopped evolving: modern Fortran (the 2018 standard, followed by Fortran 2023) has modules, derived types, whole-array operations, and built-in parallelism via coarrays — a very different beast from the punched-card FORTRAN 77 of legend. Weather forecasting at ECMWF and NOAA, climate models, computational chemistry codes, and the LAPACK/BLAS libraries underneath NumPy all run on it, compiled by the actively developed gfortran and flang. Engineering and physics programs still teach it for numerical methods. Here you can compile and run modern Fortran in a live terminal, typing values into read statements as the program executes.

Hello World in Fortran

program interactive_demo
  implicit none
  character(len=40) :: name
  integer :: n, i
  real, allocatable :: v(:)

  write(*, '(a)', advance='no') 'What is your name? '
  read(*, '(a)') name
  print *, 'Hello, ', trim(name), '!'

  write(*, '(a)', advance='no') 'How many squares to build? '
  read(*, *) n

  allocate(v(n))
  v = [(real(i)**2, i = 1, n)]   ! array constructor with implied do

  print *, 'Squares:', v
  print *, 'Sum  =', sum(v)
  print *, 'Mean =', sum(v) / n
end program interactive_demo

When to use Fortran

Fortran skills open doors in high-performance computing: national labs, weather and climate centers, aerospace CFD groups, and computational physics research all maintain large Fortran codebases and hire people who can read and modernize them. University numerical-methods courses in physics and engineering departments still assign Fortran for exactly this reason. Use this page to practice array syntax, do-loops, format descriptors, and allocatable arrays — or to test a subroutine's logic quickly before running it inside a large simulation where compile cycles are expensive.

Common questions

Can I type values into read(*,*) while the program runs?

Yes — list-directed read statements pause the program until you enter values in the terminal, and write output streams beforehand, so prompts show up first. Use advance='no' in the write format, as the example does, to keep the cursor on the prompt line like a classic console program.

Is this modern Fortran or FORTRAN 77?

Modern, free-form Fortran compiled with gfortran — you get modules, allocatable arrays, whole-array expressions, intrinsic functions like sum and matmul, and everything through the recent standards the compiler supports. Fixed-form F77 code generally still compiles too, since gfortran handles legacy sources, but new code should use free form.

Can I link LAPACK, MPI, or OpenMP here?

External libraries like LAPACK and MPI aren't linkable in this single-file sandbox, and multi-node parallelism isn't meaningful in it. Intrinsic numerics (matmul, dot_product, random_number) work fine for algorithm development. The realistic workflow: validate your numerical logic here, then build with the full HPC stack on your cluster.

How Fortran runs on XCODX

Sandbox filename
main.f90
Entry point
single main source file
Editor grammar
fortran
Reading stdin
read(*,*)
Input delivery
live WebSocket stream
Prompt flushing
flush manually before reading input
Compile limit
10 s
Run limit
3 s batch · up to 3 min live
Memory
256 MB per stage
Max source
50,000 characters

Default program on this page

program hello
    implicit none
    print *, 'Hello from Fortran!'
    print *, 'Welcome to XCODX Online Compiler!'
end program hello