OCamlFormat
OCamlFormat: A configurable OCaml formatter with Dune, editor, RPC, and library integrations. Ranked #24 of 34 in Code Formatting Tools by our editors (6.9/10); pricing: Free plan; best for OCaml projects using Dune.
At a glance
- Editor score6.9 / 10
- PricingFree plan
- Best forOCaml projects using Dune
- Free planYes
- Paid fromFree
- Supported languagesOCaml
- Facts checked21 Sep 2026

Where it wins
- Formats code, comments, docstrings, and code blocks in comments
- Supports .ocamlformat profiles and .ocamlformat-ignore rules
- Offers Dune, RPC, editor-plugin, and programmatic API integration
Where it doesn't
- Focused on OCaml rather than multiple programming languages
- Requires project configuration for tailored formatting profiles
- Its feature set centers on formatting rather than broader code quality checks
Our verdict on OCamlFormat
OCamlFormat is an open-source automatic formatter for OCaml projects, with particular fit for teams using Dune. It formats OCaml source files as well as comments, docstrings, and OCaml code blocks inside comments. Developers can run it from the command line, apply formatting in place, or check whether files are formatted without changing them. Project-level behavior is controlled through .ocamlformat files, making the tool suitable for repositories that need shared formatting rules rather than ad hoc local preferences.
Configuration and repository control are central to the product. Formatting profiles and options allow projects to define how code should be presented, while .ocamlformat-ignore files exclude selected files from formatting. Dune integration through dune fmt connects formatting with an existing OCaml build workflow. Editor plugins extend the same formatting capability into development environments, and ocamlformat-rpc supports formatting requests through an RPC server. These options make OCamlFormat adaptable across command-line, build, editor, and tooling workflows without limiting use to a single interface.
The programmatic library API is useful when formatting needs to be embedded into another OCaml tool or development process. The MIT License and open-source distribution also suit projects that want to inspect, integrate, and adapt the formatter within their own workflows. OCamlFormat is a strong choice for OCaml teams seeking consistent formatting with explicit project rules and Dune support. Projects looking for a multi-language formatter or a broader suite of code analysis features should choose a different category tool, since OCamlFormat is narrowly focused on formatting OCaml code.
Your product? Our editors can test OCamlFormat in depth and publish a review, labelled as paid · from $149/mo →
OCamlFormat pricing
OCamlFormat fact sheet
| Free plan | Yes |
|---|---|
| Paid from | Free |
| Supported languages | OCaml |
| Supported platforms | Not verified |
| Editor integration | Yes |
| Ignore files | Yes |
| Changed-lines formatting | Not verified |
| Library API | Yes |
| License model | Open_source |
| Deployment | Self-hosted |
| Support | Community, Docs |
| Built for | Solo, Small business, Mid-market, Enterprise (editorial estimate) |
| Integrations | 3 integrations: Dune, Editor plugins, ocamlformat-rpc |
| Pricing | Free plan |
| Website | github.com |
| Facts checked | 21 Sep 2026 |
OCamlFormat integrations
OCamlFormat lists 3 integrations on its own site.
- Dune
- Editor plugins
- ocamlformat-rpc
Alternatives to OCamlFormat
- dprintA broad, editor-friendly formatter for multilingual repositories and changed-file workflows.9.4
- PrettierA broad, open-source formatter for web-language teams across editors and workflows.9.2
- SpotlessA build-focused formatter for JVM projects that need broad language coverage and automation.9.0
See all OCamlFormat alternatives →
Used OCamlFormat? Be the first to review it
The editor score above is our own research. What this page doesn't have yet is a reader's view — what you used OCamlFormat for, what worked and what didn't. No stars are seeded and no review is paid for; an editor reads every one before it appears.
Write a reviewTwo minutes · verified accounts only · read by an editor before it appears
Featured on iTechGuides
OCamlFormat is listed in our Code Formatting Tools directory. Add the badge to your site — it links back to this page.
<a href="https://www.itechguides.com/products/ocamlformat/"><img src="https://www.itechguides.com/best/badge/ocamlformat.svg" alt="Featured on iTechGuides" width="230" height="46"></a>
Reviewed by iTechGuides Editors · Editorial team · Updated Oct 2026
Advertiser disclosure: iTechGuides is reader-supported. Vendors can pay for top positions in our rankings and for a place on other products' pages, and we may earn a commission when you click some links. Bought places stand at the number bought; this page and our disclosure say so. Paying vendors may get a fuller, more detailed review from our editors, and that review can change their score. How we rank.
Last updated · How we research and update
