Skip to content
gfortran 13.3.0

Online Fortran Compiler & Editor

myCompiler is a free online Fortran compiler, editor and code runner that lets you write, run, and share Fortran code directly in your browser. It works as your Fortran playground, sandbox, fiddle, cloud compiler, and online REPL. No downloads, no installation needed. Just open the editor and start coding with syntax highlighting, autocomplete, and instant output.

27+ languages Used by 1M+ developers Free forever

How to run Fortran code online

Three steps to go from idea to running Fortran code in this online playground. No account required.

Write your code Code editor with syntax highlighting, line numbers, and a file tab showing the current language main.f90 1 1 2 3 4 5 6 7 Fortran Ln 7, Col 25

Write your code

Open the Fortran editor and start writing. The smart editor gives you syntax highlighting, autocomplete, and error detection as you type.

Click Run Editor with a Run button and keyboard shortcut hint to execute code on cloud servers main.f90 2 Run or press Ctrl +

Click Run

Hit the Run button or press +Enter to run your Fortran code on secure, sandboxed cloud servers.

See results Integrated terminal displaying program output with command prompt and execution results main.f90 3 1 2 ... Terminal $ gfortran main.f90 && ./a.out $ Program finished

See results

Output appears instantly in the integrated terminal. Errors and exceptions show up with clear, helpful messages.

Everything you need to code in Fortran

A complete online Fortran IDE and coding playground in your browser. Write, run, and share code without any setup.

Zero setup required

Start coding in seconds with this browser-based Fortran interpreter. No downloads, no installations, no environment configuration. Open your browser, go to myCompiler, and start writing Fortran code immediately.

Works on any device with a web browser. Desktop, laptop, tablet, phone, Chromebook. There is nothing to install and nothing to configure.

Feature-rich code editor

Write Fortran with a professional-grade code editor built into your browser. Syntax highlighting colors your code for readability, making keywords, strings, and functions easy to distinguish at a glance.

Intelligent autocomplete suggests methods and properties as you type, and real-time error detection catches mistakes before you run your code.

Multi-file projects

Create and manage multiple files in a single project. Use the file sidebar to organize your code into modules, then import them across files just like in a desktop IDE.

Build modular applications with proper project structure. Each file is editable, and you can switch between them instantly.

Run code instantly

Click the Run button or press +Enter to execute your Fortran code instantly. This online code runner displays output immediately in the integrated terminal panel. Your code runs on secure, sandboxed cloud servers and results appear in seconds.

Error messages and tracebacks are displayed clearly, making it easy to find and fix issues. The terminal supports ANSI colors for rich output formatting.

Ready to try it? Write and run your first Fortran program in seconds.

Open Fortran editor

Fortran on myCompiler

myCompiler runs gfortran 13.3.0, always up to date with the latest stable release. You get a full browser-based IDE with syntax highlighting, intelligent code completion, multi-file project support, a built-in terminal for real-time output, and standard input (stdin) for interactive programs. Write, compile, run, and debug Fortran code on any device. Desktop, laptop, tablet, phone, Chromebook. Zero downloads, zero configuration, and no sign-up required. Save your programs with a unique URL and share them with anyone. You can also embed a working Fortran editor on your own website.

Use this online Fortran playground as a quick code executor for testing snippets, a coding sandbox for learning, or a cloud compiler for coding interview preparation. The editor includes dark mode for comfortable coding, keyboard shortcuts for faster workflows, and clear error messages with line numbers so you can debug quickly. Students use it for homework and practice. Teachers use it to share working examples. Developers use it to prototype ideas. myCompiler is beginner-friendly, fast, and completely free. It works in any modern web browser.

Start coding in Fortran

Fortran code examples

Common Fortran patterns you can try in the online compiler. Each example is ready to run.

Hello World in Fortran

main.f90
program main
    print *, 'Hello, World!'
end program

Variables and Data Types in Fortran

main.f90
program main
    implicit none
    character(len=20) :: name
    integer :: age
    real :: height
    name = "Alice"
    age = 30
    height = 5.6
    print *, trim(name), " is", age, "years old"
end program

If-Else Conditionals in Fortran

main.f90
program main
    implicit none
    integer :: x
    x = 10
    if (x > 0) then
        print *, "Positive"
    else if (x == 0) then
        print *, "Zero"
    else
        print *, "Negative"
    end if
end program

For and While Loops in Fortran

main.f90
program main
    implicit none
    integer :: i
    do i = 1, 5
        print *, "Count:", i
    end do

    i = 1
    do while (i <= 3)
        print *, "While:", i
        i = i + 1
    end do
end program

Functions in Fortran

main.f90
program main
    implicit none
    integer :: factorial
    print *, factorial(5)
    print *, factorial(10)
end program

recursive function factorial(n) result(res)
    implicit none
    integer, intent(in) :: n
    integer :: res
    if (n <= 1) then
        res = 1
    else
        res = n * factorial(n - 1)
    end if
end function

Arrays and Collections in Fortran

main.f90
program main
    implicit none
    integer :: nums(5) = [1, 2, 3, 4, 5]
    real :: matrix(2, 2)
    integer :: i

    print *, "Sum:", sum(nums)
    print *, "Max:", maxval(nums)

    matrix = reshape([1.0, 2.0, 3.0, 4.0], [2, 2])
    print *, "Matrix(1,2):", matrix(1, 2)
end program

Derived Types in Fortran

main.f90
module shapes
    implicit none
    type :: Circle
        real :: radius
    end type
contains
    real function area(c)
        type(Circle), intent(in) :: c
        area = 3.14159 * c%radius ** 2
    end function
end module

program main
    use shapes
    implicit none
    type(Circle) :: c
    c%radius = 5.0
    print *, "Area:", area(c)
end program

Error Handling in Fortran

main.f90
program main
    implicit none
    integer :: ios
    real :: x
    character(len=50) :: errmsg

    read(*, *, iostat=ios, iomsg=errmsg) x
    if (ios /= 0) then
        print *, "Read error (using default)"
        x = 0.0
    end if
    print *, "Value:", x
end program

File I/O in Fortran

main.f90
program main
    implicit none
    integer :: unit = 10, ios
    character(len=100) :: line

    open(unit=unit, file="output.txt", status="replace", iostat=ios)
    write(unit, *) "Hello, File!"
    close(unit)

    open(unit=unit, file="output.txt", status="old")
    read(unit, "(A)") line
    close(unit)
    print *, trim(line)
end program

Array Operations in Fortran

main.f90
program main
    implicit none
    integer :: i
    real :: v(5) = [1.0, 4.0, 9.0, 16.0, 25.0]
    real :: sq(5)

    sq = sqrt(v)

    print *, "Original:", v
    print *, "Sqrt:    ", sq
    print *, "Dot product:", dot_product(v, sq)
end program

How to take input in Fortran online

myCompiler supports standard input (stdin) for Fortran programs. Use Fortran's standard input functions to read user input. Enter your input data in the stdin panel before running your program.

This works for both single-line and multi-line input. You can read strings and convert to numbers using the language's built-in I/O functions.

Try it yourself
main.f90 stdin supported
program main
    implicit none
    character(len=50) :: name
    integer :: age

    read(*, '(A)') name
    read(*, *) age

    write(*, '(A,A,A)') 'Hello ', trim(name), '!'
    write(*, '(A,I0,A)') 'You will be ', age + 1, ' next year.'
end program
stdin
Alice
25
Output
Hello Alice!
You will be 26 next year.

No setup, no sign-up. Start writing Fortran code right now.

Start coding now

Getting started with Fortran online

You can start writing and running Fortran code right now without installing anything. Type your code, and click Run. This free Fortran code runner executes your program instantly and displays the output in the terminal panel below the editor. Open the Fortran online editor, type your code, and click Run.

If you're new to Fortran, use this online Fortran playground to start with the basics like variables, data types, conditionals, and loops. The code examples above cover all the fundamentals you need to get started. Each example can be copied into the sandbox and run immediately. No setup, no configuration.

As you progress, try creating multi-file projects, using libraries, and sharing your programs with others via URL. Sign up for a free account to save your work and build a personal library of programs. myCompiler works as a full online Fortran IDE right in your browser.

Who uses myCompiler

Whether you're learning to code, preparing for interviews, or prototyping ideas, myCompiler is built for you.

Students & Learners

Practice exercises, complete homework assignments, and experiment with code without installing anything on school or personal computers.

Teachers & Educators

Share code examples with students via unique URLs. Embed the compiler in course materials so students can run examples directly in the browser.

Interview Candidates

Practice coding interview problems, test algorithms, and verify solutions quickly during preparation for technical interviews.

Professional Developers

Quickly prototype ideas, test code snippets, or try out a library without setting up a local environment. Great for quick experiments.

Content Creators & Bloggers

Embed interactive examples in blog posts, tutorials, and documentation so readers can run code without leaving the page.

Teams & Collaborators

Share code snippets with colleagues via URLs. Others can view, run, and fork your code to build on your work.

myCompiler vs. local IDE

Why use an online Fortran compiler instead of installing one locally?

Feature myCompiler Local IDE
Setup time Instant Minutes to hours
Installation None required Fortran + IDE required
Device support Any browser Desktop only
Sharing code One-click URL Manual (file, git, etc.)
Languages 27+ in one place One at a time
Cost Free forever Free to $$$
Works on Chromebook Yes Limited

What is Fortran?

Fortran (Formula Translation) is one of the oldest high-level programming languages, first developed by a team at IBM led by John Backus and released in 1957. It was the world's first compiled high-level language, proving that machine-generated code could be as efficient as hand-written assembly. Fortran pioneered concepts like subroutines, variables, and loops that all subsequent languages inherited.

Modern Fortran (Fortran 90, 95, 2003, 2008, 2018) is a thoroughly contemporary language with array operations as first-class constructs, modules, object-oriented features, and parallel computing via coarrays and OpenMP/MPI integration. It remains the dominant language for high-performance scientific computing because of its exceptional numerical performance and decades of optimized libraries.

What is Fortran used for?

Fortran is used for numerical simulation and scientific computing in physics, chemistry, and engineering, climate and weather modeling (most major climate models are written in Fortran), computational fluid dynamics, finite element analysis, quantum chemistry, and high-performance computing (HPC) on supercomputers. Libraries like BLAS, LAPACK, and LINPACK, the foundation of numerical computing, are written in Fortran.

Fortran for beginners

Fortran is not typically a first language, but it is a necessary language for computational scientists and engineers. If you are in physics, engineering, or a STEM field that involves numerical simulation, you will encounter Fortran. Modern Fortran's syntax is cleaner than its reputation suggests, the free-form source format introduced in Fortran 90 reads much like other structured languages. Use myCompiler's online Fortran compiler to practice without installing gfortran.

Fortran vs other languages

Compared to C/C++, Fortran's array syntax and built-in mathematical operations make numerical code more readable and often allow compilers to optimize better for scientific workloads. Compared to Python/NumPy, Fortran produces significantly faster code for computation-heavy simulations, though Python is easier and more flexible for general use. Compared to MATLAB/Octave, Fortran is faster and free-form, but MATLAB has more interactive toolboxes for engineers.

Why use an online Fortran compiler?

An online Fortran compiler, also called a Fortran sandbox or Fortran runner, lets you compile and run Fortran programs directly in your browser without installing gfortran. This is invaluable for students in computational science courses, researchers who need to test numerical algorithms, and anyone learning Fortran array operations and intrinsic functions.

myCompiler's online Fortran compiler uses gfortran, supporting modern Fortran standards including free-form source, modules, arrays, and mathematical intrinsics. You can provide stdin input for interactive programs, save your Fortran code, and share via URL, completely free.

Why is Fortran so popular?

Fortran's continued relevance after nearly 70 years is a testament to its unmatched performance for numerical computing. The world's fastest supercomputers run Fortran for climate modeling, molecular dynamics, and computational physics. BLAS and LAPACK, the linear algebra libraries used by NumPy, SciPy, MATLAB, and R under the hood, are written in Fortran. While new scientific code is often written in Python or C++, Fortran's legacy codebase in simulation and HPC ensures it will remain relevant for decades.

Fortran career opportunities

Fortran expertise is valued for computational scientist, HPC engineer, numerical analyst, and scientific software developer roles at national laboratories (NASA, NOAA, national energy labs), defense contractors, and academia. Fortran skills combined with MPI, OpenMP, and HPC cluster experience command excellent salaries in scientific computing roles.

Try Fortran online Free · No sign-up needed

Keyboard shortcuts

Code faster with these keyboard shortcuts in the myCompiler editor.

Run code
+ Enter
Save program
+ S
Toggle comment
+ /
Indent line
Tab
Unindent line
Shift + Tab
Undo
+ Z
Select next occurrence
+ D
Find & replace
+ H

Embed the Fortran compiler on your website

Add an interactive Fortran compiler to your website, blog, or learning platform. Readers can write and run Fortran code directly on your page without leaving it.

Perfect for technical tutorials, coding courses, documentation, and educational content. Save a program on myCompiler and use the embed link to add it to any webpage.

Embedded Fortran compiler, editor and code runner
Output Run
HTML
<iframe
src="https://www.mycompiler.io
    /embed/fortran"
width="100%"
height="400"
frameborder="0">
</iframe>

Why developers choose myCompiler

A full-featured online IDE for Fortran and 27+ other programming languages.

27+ Languages

Python, JavaScript, Java, C++, Rust, Go, TypeScript, C#, and many more. All compilers and interpreters in one place. Switch languages instantly.

Dark & Light Mode

Switch between light and dark themes with one click. Code comfortably in any lighting condition, day or night.

Mobile Friendly

Fully responsive editor optimized for phones, tablets, and Chromebooks. Code on any device with a web browser. No app download needed.

Save & Share Code

Save programs to your account, share via unique URLs, and let others view, fork, and run your code. Great for collaboration and code reviews.

Tags & Organization

Organize your saved programs with tags and find them quickly with search and filters. Build a personal library of code snippets and solutions.

No Account Required

Start writing and running code immediately. No sign-up, no email, no credit card. Create a free account later only if you want to save your work.

Frequently asked questions

Common questions about using the online Fortran compiler, playground, and code runner.

Yes! myCompiler is completely free for all supported languages including Fortran. There are no subscriptions, no premium tiers, and no hidden costs. Every feature is available at no charge.
myCompiler keeps its Fortran environment up to date. You can see the exact version on the language details section of this page. We regularly update all language runtimes to their latest stable versions.
myCompiler uses the GNU Fortran compiler (gfortran) which supports modern Fortran standards. You can use modules, array operations, and other modern Fortran features in your programs.
Simply open the Fortran editor, write or paste your code, and click the Run button. Your code will be executed on our servers and the output will appear in the terminal panel within seconds.
Yes. Click Save to store your program. You will receive a unique URL that you can share with anyone. Recipients can view, fork, and run your code.
Yes. myCompiler supports multi-file projects. You can create, rename, and delete files in the sidebar. This lets you organize your Fortran code just like in a local IDE.
Yes. All code runs in isolated containers on our servers. Each execution gets its own sandboxed environment that is destroyed after completion. Your code cannot affect other users or our infrastructure.
Yes. myCompiler has a responsive design optimized for phones and tablets. You can write and run Fortran code on the go. The mobile interface uses tabs for switching between the editor, output, and file panels.
Yes. Click the Input tab in the bottom panel, type or paste your input data, then click Run. Your program will read from the input you provided.
Execution is fast. Code runs on our optimized cloud infrastructure and output typically appears within seconds. Execution time depends on the complexity of your program.
Yes. myCompiler provides an embed feature. You can copy an iframe snippet and paste it into your website, blog, or documentation. Visitors can edit and run code directly on your page.
myCompiler supports common editor shortcuts including Run (Ctrl/Cmd+Enter), Save (Ctrl/Cmd+S), Find (Ctrl/Cmd+F), and more. See the keyboard shortcuts section on this page for the full list.
No. myCompiler requires an internet connection because code is compiled and executed on our cloud servers. The editor itself loads in your browser, but running code requires connectivity.
myCompiler offers a fast, free, zero-setup environment with a modern code editor, multi-file support, dark mode, and instant sharing. It is ideal for learning, prototyping, interviews, and sharing code examples.
Yes. myCompiler is great for practicing algorithms and coding problems. You can write Fortran code, provide custom input, and test your solutions instantly. Save your work and come back to it anytime.
Use print statements or console output to trace your program's behavior. myCompiler shows all standard output and error messages in the terminal panel. Error messages include line numbers to help you locate issues.

Ready to write Fortran code?

Open the free Fortran playground and start coding immediately. No downloads, no account required.

Start coding in Fortran

Free · No sign-up required · gfortran 13.3.0

Start coding in Fortran