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
BE SAFE
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.
BUILD FASTER
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.
WORK JOYFULLY
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.
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
Curated Resources
Get up to speed quickly to enjoy the benefits of the OCaml programming language across your projects.
Getting Started
Install OCaml, set up your favorite text editor and start your first project.
Language Manual
Read the reference manual of the language and documentation on the compiler.
Books
What expert programmers and researchers are saying about OCaml, from the beginner level to more advanced topics.
Standard Library
Searchable API documentation.
Exercises
Learn OCaml by solving problems on a variety of topics, from easy to challenging.
Papers
Papers that have influenced OCaml and other functional programming languages.