Freedom251 › Code Formatting Tools
OCamlFormat

What OCamlFormat is
OCamlFormat is a free formatter for OCaml code that can also format comments, docstrings, and code blocks inside comments. It offers three profiles—`default`, `ocamlformat`, and `janestreet`—and lets projects store a chosen profile and other options in a `.ocamlformat` file. For integration with other tools, it provides an RPC server, and its README shows a Dune workflow using `dune fmt`. Installation is through opam and requires OCaml and opam on your system; the package listing specifies OCaml 4.08 or later and Dune 2.8 or later as dependencies. The project is part of the OCaml Platform, which is described as the recommended set of OCaml tools. It is open source under the MIT License, with editor integration, ignore-file support, and a library API. The project links to contribution and hacking guides and an OCaml Discuss forum section for discussion. Its listed latest package version is 0.29.0, published on 18 Mar 2026.
Who it suits
OCaml developers who want configurable formatting for code and comments may find it useful. Its opam installation and OCaml and Dune requirements are relevant when setting it up.
What it does well
- Three predefined formatting profiles.
- Project options can be stored in `.ocamlformat`.
- Formats comments, docstrings, and code blocks in comments.
- Provides an RPC server and library API.
- MIT-licensed and free.
What to know first
- Requires OCaml and opam for installation.
- Package dependencies include Dune 2.8 or later.
- Supports OCaml only.
Plans
| Plan | Billed and limits | Price |
|---|---|---|
| OCamlFormat | OCaml code formatter · installable with opam · MIT License | Free |
As github.com lists them, read 8 Oct 2026. The maker's own page has the final word.
Verdict
OCamlFormat combines project-level formatting settings with integrations for Dune and other tools. Check its OCaml and Dune requirements before adding it to a project.
Facts from OCamlFormat's own pages
- Audience
- The project is part of the OCaml Platform, described as the recommended set of tools for OCaml. · github.com, 8 Oct 2026
- Comments
- It can format comments, docstrings, and code blocks in comments. · github.com, 8 Oct 2026
- Current package version
- The OCaml package listing identifies version 0.29.0 as latest and shows it published on 18 Mar 2026. · ocaml.org, 8 Oct 2026
- Customization
- Users can select a profile and configure options in a project’s `.ocamlformat` file. · github.com, 8 Oct 2026
- Dependencies
- The package listing specifies OCaml `>= 4.08` and Dune `>= 2.8` as dependencies. · ocaml.org, 8 Oct 2026
- Formatting profiles
- It includes predefined profiles named `default`, `ocamlformat`, and `janestreet`. · github.com, 8 Oct 2026
- Installation
- Installation is through opam, and the README says OCaml and opam are required. · github.com, 8 Oct 2026
- Integration
- The README shows use with the Dune build system via `dune fmt`. · github.com, 8 Oct 2026
- License
- OCamlFormat is distributed under the MIT License. · github.com, 8 Oct 2026
- Platform
- The installation instructions require OCaml and opam on the user's system and show command-line usage. · github.com, 8 Oct 2026
- Purpose
- OCamlFormat is a code formatter for OCaml. · github.com, 8 Oct 2026
- RPC
- It provides an RPC server that other tools can use to format OCaml code. · github.com, 8 Oct 2026
- Support and community
- The README links to contribution and hacking guides and an OCaml Discuss forum section for project discussions. · github.com, 8 Oct 2026
Where OCamlFormat stands on Freedom251
- Code Formatting Tools#24 of 34