XCODX |

F# 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 F#

F# is a functional-first, multi-paradigm language for the .NET platform, designed by Don Syme at Microsoft Research and first released in 2005. This mode compiles your code the way a normal project does: the F# compiler produces a .NET assembly that then runs, so you work with an [<EntryPoint>], full type checking, and compiled performance. Following the ML tradition, F# defaults to immutable data and uses type inference to stay concise while remaining statically typed. It is used in finance, data science, and backend services by teams that want functional-style safety together with the .NET runtime and its libraries. On XCODX, F# runs in a cloud sandbox and is compiled before it runs, so you can try the language and the .NET standard library without installing the .NET SDK.

Hello World in F#

// Compiled F# on .NET: the entry point returns an int exit code
[<EntryPoint>]
let main argv =
    printf "What is your name? "
    let name = System.Console.ReadLine()
    printfn "Hello, %s!" name
    let total = [ 1 .. 5 ] |> List.sum
    printfn "Sum of 1..5 is %d" total
    0

When to use F#

Compiled F# fits shipping real .NET software with a functional accent: web backends with frameworks like Giraffe or ASP.NET Core, financial and quantitative models, data pipelines, and domain modeling where discriminated unions and records make illegal states hard to represent. You get the .NET runtime's performance and interop with the large C# and .NET library base. Choose it over the scripting mode when you need an entry point, multiple files, or predictable startup and speed. It is overkill for a three-line calculation you just want to evaluate once, where a script is quicker.

Common questions

How do I read a line of input in F#?

System.Console.ReadLine() returns the next line from standard input as a string, or null at end of input; parse it with int, System.Int32.Parse, or System.Double.Parse. On XCODX you can type into the live terminal or paste into the Stdin Box, and Ctrl+D closes the stream.

Can I add NuGet packages?

No. The sandbox compiles against the F# core library and the .NET base class library only, and it has no network access, so there is no NuGet restore and no paket. Third-party packages such as Giraffe or FSharp.Data are unavailable; use namespaces like System, System.Collections.Generic, and System.Text.

Do I need an [<EntryPoint>] and a return value?

Yes for a compiled program: execution starts at the function marked [<EntryPoint>], which takes a string array of arguments and returns an int exit code, so end with 0 for success. This is the main difference from F# script mode, where top-level statements run without an entry point.

Is F# compiled or interpreted here?

Compiled. The F# compiler turns your code into a .NET assembly that is then executed, so type and format-string errors are reported before anything runs. That differs from F# Interactive, which evaluates .fsx scripts as it reads them.

Can I call the .NET base class library or C# libraries?

You can use anything in the .NET base class library that ships with the runtime, such as collections, text, math, and dates, because F# runs on the same runtime as C#. What you cannot do is pull in external NuGet assemblies, since there is no package restore or network access.

Which F# and .NET version does XCODX run?

The F# and .NET versions are shown in the badge next to the editor. It is free with no signup and no local install, and each run starts from a fresh sandbox with no saved state.

How F# runs on XCODX

Sandbox filename
main.fs
Entry point
main.fs entrypoint
Editor grammar
mllike
Reading stdin
Console.ReadLine()
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

// F# .NET Program
printfn "Hello from F#.NET!"
printfn "Welcome to XCODX Online Compiler!"

let numbers = [1..10]
let sum = List.sum numbers
let evens = List.filter (fun x -> x % 2 = 0) numbers
printfn "Numbers: %A" numbers
printfn "Sum: %d" sum
printfn "Evens: %A" evens

The .NET toolchain emits a spurious "Can't rename" line during compilation. It is suppressed on a successful build.