EVERYTHING XIAOMI
Get listed

clang-format

clang-format is a free, open-source set of tools for formatting source code, available as a standalone command-line program and through editor integrations.

Place
#28 of 34
Score
5.5
clang-format's website

What clang-format is

clang-format is a free, open-source set of tools for formatting source code, available as a standalone command-line program and through editor integrations. Its standalone tool formats C, C++, Java, JavaScript, JSON, Objective-C, Protocol Buffers, C#, TableGen, TextProto, and Verilog. You can choose built-in LLVM, GNU, Google, Chromium, Microsoft, Mozilla, or WebKit styles, or set project rules in a .clang-format or _clang-format file. For focused changes, it can format selected lines or byte ranges in one input file; git-clang-format targets lines changed in commits or staged changes, and clang-format-diff.py processes changed lines from unified diff output. A .clang-format-ignore file can exclude paths. Documented editor integrations include Vim, Emacs, BBEdit, CLion, Visual Studio, and Visual Studio Code. Source and pre-built binaries are listed for Windows, macOS, and Linux. The code is licensed under Apache 2.0 with LLVM exceptions.

Good

  • Supports a broad range of programming and text formats.
  • Includes seven built-in style presets.
  • Can target changed lines in Git workflows.
  • Editor integrations are documented for several editors.
  • Free and open source under Apache 2.0 with LLVM exceptions.

Watch out

  • Line- or byte-range formatting accepts only one input file.

Who it suits

It suits developers who want consistent source formatting from a standalone tool or editor integration. Its style presets and project-level configuration support teams with established formatting rules.

Verdict

clang-format offers configurable formatting through a standalone tool and documented editor integrations. Its single-file limit for line- or byte-range formatting is worth noting for targeted edits.

The facts

Each one read from clang-format's own pages, with the date it was checked.

What it does

Configuration
Formatting styles can be set with command-line options or project-level .clang-format or _clang-format files.checked 30 Sep 2026
Distribution
The LLVM project provides source and pre-built binary downloads, with listed binaries including Windows, macOS, and Linux platforms.checked 30 Sep 2026
Editor integrations
The documentation describes integrations for Vim, Emacs, BBEdit, CLion, Visual Studio, and Visual Studio Code.checked 30 Sep 2026
Git integration
The git-clang-format script can format lines changed in commits or staged changes.checked 30 Sep 2026
Git workflow
The git-clang-format script can format lines changed in commits or staged changes.checked 30 Sep 2026
Ignore rules
A .clang-format-ignore file can contain path patterns for files that clang-format should skip.checked 30 Sep 2026
Intended users
The documentation presents ClangFormat as a standalone tool and editor integration for source-code formatting workflows.checked 30 Sep 2026
Languages
The standalone tool formats C, C++, Java, JavaScript, JSON, Objective-C, Protobuf, and C# code.checked 30 Sep 2026
License
LLVM releases are distributed under the Apache-2.0 license with LLVM exceptions, which the download page describes as OSI-approved.checked 30 Sep 2026
Limit
Formatting a line range or byte range can only be used with one input file.checked 30 Sep 2026
Patch workflow
The clang-format-diff.py script reads unified diff output and reformats the changed lines.checked 30 Sep 2026
Purpose
ClangFormat is a set of tools built on LibFormat for formatting source code, available as a standalone tool and through editor integrations.checked 30 Sep 2026
Release verification
LLVM source packages and Git tags are signed by release managers, and the page provides keys for verification.checked 30 Sep 2026
Selective formatting
The command-line tool can format specified line or byte ranges in a single input file.checked 30 Sep 2026
Style configuration
Users can select built-in LLVM, GNU, Google, Chromium, Microsoft, Mozilla, and WebKit styles or configure formatting in a .clang-format file.checked 30 Sep 2026
Style presets
Built-in style presets include LLVM, GNU, Google, Chromium, Microsoft, Mozilla, and WebKit.checked 30 Sep 2026
Support
The Clang guide directs users who encounter problems to file bugs on the LLVM bug tracker.checked 30 Sep 2026
Support and community
LLVM directs users to its Discourse forum and mailing lists, and announces new releases in its Announce category.checked 30 Sep 2026

Where it runs

Linux and macOS availability
The Clang guide describes building on Unix-like systems and says Clang is provided by major BSD and GNU/Linux distributions and is the default compiler for Mac OS X from Xcode 4.2.checked 30 Sep 2026
Windows availability
The Clang build guide documents building Clang on Windows using Visual Studio.checked 30 Sep 2026

Alternatives to clang-format

All alternatives
  1. 1Prettier logo

    Prettier

    Free planOpen sourceWebAPIExtensionLinux
    7.5Free plan
  2. 2

    Avidemux

    Free planOpen sourceWebLinuxmacOSWindows
    7.3Free plan
  3. 3

    Fourmolu

    Free planWebLinuxWindows
    6.7Free plan
  4. 4

    rustfmt

    Free planLinuxmacOSWindows
    6.6Free plan
  5. 5

    Black

    Free planLinuxmacOSSelf-hostedWindows
    6.5Free plan
  6. 6Ruff logo

    Ruff

    Free planWebLinuxmacOSSelf-hosted
    6.5Free plan