fmtlib/fmt

A modern formatting library

View on GitHub ↗Jump to charts ↓Open shareable report

Summary Information

Updated 23 minutes ago
Added to GitGenius on March 9th, 2026
Created on December 7th, 2012
Open Issues & Pull Requests: 13 (+0)
Number of forks: 2,955
Total Stargazers: 23,757 (+0)
Total Subscribers: 319 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 8.7 hours
Mean response time: 90.2 days
90th percentile: 29.7 days
Tracked items: 550

How this project is maintained

Around half of the issues opened in the past year never receive a reply. Work labelled "question" is answered fastest, typically in about 7 hours, while "enhancement" waits about 2 days. Only 12% of issues opened in the past year have been closed. Three people close 93% of everything that gets resolved.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 7
New in 7 days: 1
Closed in 7 days: 1
Avg open age: 282 days
Stale 30+ days: 7
Stale 90+ days: 5

Recent activity

Opened in 7 days: 1
Closed in 7 days: 1
Comments in 7 days: 1
Events in 7 days: 4

Top labels

  • question (262)
  • invalid (34)
  • help wanted (31)
  • duplicate (30)
  • enhancement (15)
  • wontfix (4)

Detailed Description

The fmt library is an open-source C++ formatting library that provides a modern, fast, and safe alternative to C stdio and C++ iostreams. Written primarily in C++, it implements the C++20 std::format and C++23 std::print standards while offering a format string syntax similar to Python's format method. The library is designed to be both performant and type-safe, addressing longstanding limitations in C++ output formatting.

The core functionality centers on a simple format API with positional arguments for localization support. The library includes a fast IEEE 754 floating-point formatter using the Dragonbox algorithm that guarantees correct rounding, shortness, and round-trip properties. It provides portable Unicode support and a safe printf implementation that includes POSIX extensions for positional arguments. Users can extend the library to support custom user-defined types, and the implementation prioritizes high performance across multiple use cases including integer-to-string conversion, floating-point formatting, and file output operations.

Performance benchmarks demonstrate significant advantages over standard alternatives. In speed tests, fmt::print completes formatting operations in 0.44 seconds compared to 0.66 seconds for libc printf and 1.63 seconds for libc++ std::ostream, making it approximately 50 percent faster than printf. For floating-point formatting specifically, the library achieves 20 to 30 times faster performance than std::ostringstream and sprintf. Compile time remains competitive at 5.0 seconds for optimized builds, comparable to printf at 1.6 seconds and significantly faster than alternatives like Boost Format at 55.0 seconds. The executable size footprint is minimal, matching printf's binary size within rounding error.

The library maintains a minimal, self-contained codebase with no external dependencies and is available under a permissive MIT license. A minimal configuration requires only three header files: base.h, format.h, and format-inl.h. The implementation supports an optional header-only configuration via the FMT_HEADER_ONLY macro and maintains locale independence by default. The codebase is clean and warning-free even under strict compiler flags like -Wall -Wextra -pedantic, and it provides consistent output across different platforms with support for older compilers.

The library includes extensive testing infrastructure with a comprehensive test suite and continuous fuzzing through the Chromium OSS-Fuzz program. Safety features include compile-time format string validation in C++20 and automatic memory management that prevents buffer overflow errors. Documentation is available at fmt.dev with cheat sheets and interactive examples in Compiler Explorer, while community questions are directed to StackOverflow with the fmt tag.