Fortran Online Compiler

Write, compile, and run Fortran code online directly from your browser with our free Online Fortran Compiler. Test numerical algorithms, arrays, loops, functions, and scientific-computing logic without installing GNU Fortran (gfortran) or configuring a local compiler environment.

How to Use This Fortran Compiler

  1. Write or paste your Fortran code
    Enter your program in the Code Editor. You can test variables, arrays, loops, procedures, mathematical calculations, and other Fortran features supported by the execution environment.
  2. Click the Run button
    Select Run to compile and execute your Fortran program. If the code contains a syntax, type, compilation, or runtime error, review the returned feedback, correct the relevant statement, and run it again.
  3. Check the Output screen
    Your calculated results and compiler messages appear in the Output panel. Use the available controls to copy, download, or delete the output before testing another Fortran program.

Key Features

  • Free Online Fortran Compiler: Write and execute Fortran programs directly from a modern web browser.
  • Zero Installation: No need to install gfortran, Intel Fortran, or configure a local compiler toolchain for supported programs.
  • Instant Compilation & Execution: Click Run and quickly view scientific calculations, program output, or compiler feedback.
  • Numerical Computing: Practice mathematical algorithms, floating-point calculations, iterative methods, and engineering formulas.
  • Array & Matrix Operations: Work with Fortran arrays, loops, intrinsic operations, and numerical data structures.
  • Scientific Programming: Test logic commonly used in physics, engineering, simulation, numerical analysis, and research computing.
  • Dark and Light Mode: Switch the Code Editor theme for comfortable coding in different environments.
  • Output Controls: Copy, download, or clear generated output directly from the Output panel.
1. How do I print output in Fortran using print * or write(*,*)?

Fortran provides both print and write statements for displaying output.

Using print *:

				
					program hello
    print *, "Hello, World!"
end program hello
				
			

Using write(*,*):

				
					program hello
    write(*,*) "Hello, World!"
end program hello
				
			

You can also print calculated values:

				
					program calculation
    real :: x

    x = 25.0
    print *, "Square =", x * x
end program calculation
				
			

Enter the code in the Code Editor, click Run, and view the result in the Output screen.

No. You can use this Online Fortran Compiler directly from your browser without installing gfortran, Intel Fortran, or another local Fortran compiler for supported programs.

A local compiler may still be preferable for large scientific applications, MPI/OpenMP projects, external numerical libraries, long-running simulations, or programs that require direct filesystem and hardware access.

Yes. Fortran continues to be used for numerical computing, scientific simulations, weather and climate modeling, computational physics, engineering calculations, and high-performance computing.

For example, array calculations can be written concisely:

				
					program arrays
    integer :: a(5)
    integer :: b(5)

    a = [1, 2, 3, 4, 5]
    b = a * 2

    print *, b
end program arrays
				
			

Its strong numerical capabilities and long-established scientific ecosystem make it useful for both maintaining existing research software and developing performance-focused numerical code.

A named main program commonly uses the program and end program structure because it makes the entry point clear and keeps examples easy to understand.

				
					program main
    implicit none

    print *, "Fortran program running"
end program main
				
			

Fortran also supports procedures such as functions and subroutines:

				
					program main
    implicit none

    print *, square(6)

contains

    integer function square(x)
        integer, intent(in) :: x
        square = x * x
    end function square

end program main
				
			

The exact source forms and language features accepted depend on the Fortran standard and compiler configuration used by the online environment.