OSS TanbouSign in with GitHub

handle C++ and C string formatting, output, dates, and ranges with type-safe format strings and portable performance

About these scores

OSS scale score is an unbounded metric that log-compresses and weights Stars, Watchers, Forks, and Contributors. Discovery score is the current OSS scale score minus the score at discovery. Update pace is commits in the last 30 days, growth momentum is the OSS scale score difference within the recent observation window, and OSS health is a 0–100 rating based on available recency, Community Health, and release data.

Stars
25,864
Primary language
C++
License
MIT
Repository last updated
Oct 3, 2026
On this page

Overview

{fmt} is a C++ formatting library built around APIs such as fmt::format and fmt::print. Its API family influenced C++20 std::format and C++23 std::print, and it extends to dates, ranges, styled output, and user-defined types.

Features and best fit

Based on official documentation; not hands-on tested · Content checked:

Key features

Build strings and output through type-safe fmt::format and fmt::print

Python-like format-string syntax supports positional arguments and format specifiers while keeping formatting tied to C++ types. With C++20, invalid format specifiers can be diagnosed at compile time.

Sources: [1]

Format dates, ranges, styled text, and user-defined types

Headers such as fmt/chrono.h, fmt/ranges.h, and fmt/color.h extend the same formatting model to dates, containers, and text styles, while custom formatters integrate user-defined types.

Sources: [1]

Choose header-only, CMake library, C11 API, or C++20 module integration

The library can be compiled normally or used with FMT_HEADER_ONLY. Version 12.2.0 also adds the C11 fmt-c API and a fmt::fmt-module target for C++20 modules.

Sources: [1][2][3]

Best fit

Fits C++ codebases replacing printf or iostreams with consistent cross-platform formatting

It is useful when type safety, portable Unicode handling, formatting extensibility, and compile-time checking should be shared across applications and libraries.

Sources: [1]

Before adoption

Treat upstream benchmark numbers as workload-specific

The upstream README publishes performance comparisons against printf and iostreams, but results depend on compiler, optimization settings, and data patterns. Performance-driven adoption should be measured against the real application workload.

Sources: [1]

Review deprecated APIs and include changes in 12.2.0

Version 12.2.0 removes fmt::say, deprecates some fmt::join and related overloads, and changes <fmt/core.h> so it no longer implicitly provides all of <fmt/format.h> unless compatibility is requested.

Sources: [2]

Official sources

  1. [1]{fmt} 12.2.0 README(2026-10-04)
  2. [2]{fmt} 12.2.0 release(2026-10-04)
  3. [3]{fmt} 12.2.0 CMake configuration(2026-10-04)
  4. [4]{fmt} MIT license(2026-10-04)
Supplemental curator note

{fmt} is more than a printf replacement when a codebase needs type-safe format strings and consistent output rules across platforms. Evaluate real workload performance together with compile time and binary-size tradeoffs rather than relying only on published benchmarks.

Try it in 3 steps

  1. 1

    Fetch the {fmt} 12.2.0 source

    Pin the checkout to the reviewed latest release tag.

    git clone --depth 1 --branch 12.2.0 https://github.com/fmtlib/fmt.git fmt-12.2.0
  2. 2

    Build the library with CMake

    Build the compiled library with documentation and tests disabled. The CMake configuration requests the C++11 compile feature.

    cmake -S fmt-12.2.0 -B fmt-12.2.0/build -DFMT_TEST=OFF -DFMT_DOC=OFF && cmake --build fmt-12.2.0/build --config Release
  3. 3

    Compile and run a minimal fmt::print program

    This is a Unix-like toolchain example. answer=42 confirms basic formatting and linking. On Windows, link the generated CMake target from Visual Studio instead.

    cd fmt-12.2.0 && printf '#include <fmt/base.h>\nint main() { fmt::print("answer={}\\n", 42); }\n' > demo.cc && c++ -std=c++11 demo.cc -Iinclude build/libfmt.a -o demo && ./demo
Check the official README

Growth

Growth trends · Last 30 days

25,864 Stars

Trend data is still being collected.

Development activity

Last 90 days · weekly

Commits (last 30 days)
60
Open PRs
6

Development activity is still being collected.

Built with

Categories and tags

Categories

GitHub data

GitHub dataView detailed GitHub data

GitHub Topics

  • formatting
  • printf
  • output
  • chrono
  • performance
  • multiplatform
  • cross-platform
  • cpp
  • ranges
  • floating-point
  • unicode
  • c-plus-plus
Stars
25,864
Forks
3,079
Watchers
326
Open issues
6
Contributors
436
Owner type
Organization
Primary language
C++
License
MIT
Repository last updated
Oct 3, 2026
Write a related article

Share a guide or use case for this OSS in Markdown. Articles are published after administrator approval.

Report incorrect information

Tell us if any listing information is incorrect or outdated.

After reading this page, do you know what to do next?