OCaml · online compiler

Run OCaml online

Run OCaml 5 online — algebraic types, effect handlers, no install.

Version
Firecracker microVM live per-test verdicts multi-file compile

OCaml is one of the most influential functional languages: strong type inference, algebraic data types, a serious module system, and — as of OCaml 5 — effect handlers and multicore. Popular in finance (Jane Street), academic research, and inside compilers (Flow, Reason).

ls-judge compiles OCaml 5 with the standard toolchain inside a Firecracker microVM.

Starter code

What you get in OCaml

Clicking "Run now" opens the playground with this exact code and a matching test case pre-loaded — passes on first Run.

ocaml
OCaml 5
let () =
  let n = int_of_string (input_line stdin) in
  Printf.printf "%d\n" (n * 2)
stdin →21
expected →42
FAQ

Common questions about OCaml on ls-judge

Which OCaml?
OCaml 5.x — with effect handlers and multicore support.
opam packages?
No network — standard library only.
Dune build?
Single-file compile via `ocamlfind` — dune projects are not supported on the free tier.
Free?
Yes.
Further reading
Also try