OCaml 5.0 is in beta! Try it now

General-Purpose, Industrial-Strength, Expressive, and Safe

OCaml is a general-purpose, industrial-strength programming language with an emphasis on expressiveness and safety.
let square x = x * x
val square : int -> int = < fun >
square 3
- : int = 9
let rec fac x =
if x <= 1 then 1 else x * fac (x - 1)
val fac : int -> int = < fun >
fac 5
- : int = 120
square 120
- : int = 14400

Trusted by Industry Leaders

These companies and organisations rely on OCaml every day — along with thousands of other developers. See Success Stories
Jane Street

Unobtrusive Type Safety

OCaml’s powerful type system means more bugs are caught at compile time, and large, complex codebases are easier to maintain. This makes it a good language for running critical code. At the same time, sophisticated inference makes the type system unobtrusive, creating a smooth developer experience.
An example OCaml program defining nested lists in OCaml. A terminal output also shows the compiler catching a type error where a pattern-match was not exhaustive.

Fast Compiler and Efficient Applications

OCaml has two compilers. One is a bytecode compiler which generates small, portable executables and is very fast. The other is a native code compiler that produces more efficient machine code; its performance matches the highest standards of modern compilers.

First-Class Editor and Tooling

OCaml has great support for the most popular editors. VS Code is recommended for beginners, and for power users there is deep integration with Vim and Emacs. OCaml has a rich and dynamic community and best-in-class tooling. Between Opam, a popular package manager; Utop, a powerful interactive REPL; and odoc, an easy-to-use documentation generator, OCaml programmers have access to a complete, modern developer experience.
An OCaml program being edited in VSCode
Writing an OCaml program using vim
Writing an OCaml program using emacs

Vibrant Community

OCaml has a passionate and diverse community, with more than ten thousand developers and four thousand open source packages. It is a truly general-purpose language with extensive libraries in a variety of problem areas, including data science, bioinformatics, and programming language design. OCaml has roots in academic and theoretical contexts but has also become popular among application developers looking to build command-line utilities or performant, dynamic web apps without resorting to a less safe or feature-rich language.

Users of OCaml

OCaml is used by thousands of developers, companies, research labs, teachers, and more. Learn how it fits your use case.

For Educators

With its mathematical roots, OCaml has always had strong ties to academia. Currently, it is being taught in universities around the world, and has accrued an ever-growing body of research. This page will provide you with an overview of the academic rigor that defines the culture of OCaml.

For Industrial Users

With its powerful compile-time guarantees and high performance, several companies rely on OCaml to keep their systems operating both reliably and speedily. On this page, you can get an overview of the companies in the community and learn more about how they use OCaml.

OCaml Packages

Explore thousands of open-source OCaml packages with their documentation.