A fast, safe, and modern C++ formatting library providing a type-safe alternative to printf and iostreams.
{fmt} is a modern C++ formatting library that provides a fast, safe, and extensible alternative to traditional C stdio and C++ iostreams. It implements the C++20 std::format standard and offers Python-like format string syntax with compile-time validation, preventing common errors like buffer overflows and type mismatches.
C++ developers who need efficient, type-safe text formatting for logging, output generation, or internationalization, particularly those working on performance-sensitive applications or modern C++ codebases.
Developers choose {fmt} for its exceptional performance, type safety, and small code footprint. It combines the speed of printf with the safety and extensibility of modern C++, offering features like compile-time format checking, user-defined type support, and consistent cross-platform Unicode handling.
A modern formatting library
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Fully type-safe with compile-time format string checks, preventing buffer overflows and runtime errors, as demonstrated by examples that error at compile time for invalid specifiers.
Faster than printf, iostreams, and other libraries, with benchmarks showing up to 50% speed improvement over printf and optimized floating-point formatting using the Dragonbox algorithm.
Small compiled binaries comparable to printf, with a minimal configuration of just three header files, reducing binary size and compile time as shown in bloat tests.
Supports user-defined type formatting through specialization, allowing seamless integration with project-specific data structures without hacking printf.
Portable Unicode handling with consistent output across platforms, essential for internationalized applications, and demonstrated in color printing examples.
Full feature set, including compile-time checks and std::format compliance, requires C++20 or later, which may not be available in all legacy or restricted environments.
While convenient, enabling FMT_HEADER_ONLY can significantly increase compile times in large projects, as noted in benchmarks where non-optimized builds showed higher overhead.
Does not support advanced iostream features like custom stream buffers or complex manipulators, making it less suitable for applications deeply tied to C++ stream paradigms.
Maintained on a reasonable-effort basis by volunteers, which could lead to slower response times for security advisories or feature requests, as acknowledged in the security policy.