A header-only C++11 library that lets C++ code parse, build, manipulate and serialize JSON with STL-like syntax.
fmtlib/fmt
A C++ formatting library offering a fast, type-safe alternative to C stdio and iostreams, implementing C++20 std::format.
- Stars
- 25,887
- Forks
- 3,089
- Open issues
- 16
- Last commit
- 3 days ago
What is it?
{fmt} is an open-source C++ library for formatting text, aiming to be a faster and safer alternative to C stdio and C++ iostreams. It uses a Python-like format string syntax and implements the C++20 std::format and C++23 std::print interfaces, so code can be written in a familiar style.
The library checks format strings at compile time, so mistakes such as applying an invalid specifier to a string are reported as compile errors. It also provides a printf-compatible API, formatting for chrono dates and times, containers and ranges, colored terminal output, and a floating-point formatter based on the Dragonbox algorithm. Users can add formatting support for their own types.
{fmt} has no external dependencies and is available as a small set of headers or as a header-only build. It is licensed under MIT and is used by projects such as ClickHouse, MongoDB, PyTorch and spdlog.
Key features
- 01Python-style format string syntax with positional arguments
- 02Implements C++20 std::format and C++23 std::print
- 03Compile-time checking of format strings
- 04Fast floating-point formatting using the Dragonbox algorithm
- 05Chrono, range and container formatting support
- 06Header-only mode with no external dependencies
Use cases
- Replacing printf or iostreams in performance-sensitive C++ code
- Building logging messages in libraries such as spdlog
- Formatting dates, times and containers for console output
- Writing portable C++ code that targets C++20 or older compilers
Topics
FAQ
- What is fmt?
- A C++ formatting library offering a fast, type-safe alternative to C stdio and iostreams, implementing C++20 std::format. {fmt} is an open-source C++ library for formatting text, aiming to be a faster and safer alternative to C stdio and C++ iostreams. It uses a Python-like format string syntax and implements the C++20 std::format and C++23 std::print interfaces, so code can be written in a familiar style.
- Is fmt free to use? What license does it have?
- fmt is open source under the MIT license. Check the license terms before using it in commercial products.
- Is fmt still maintained?
- Actively maintained. The last commit to fmt was on Oct 18, 2026.
- What can I use fmt for?
- Replacing printf or iostreams in performance-sensitive C++ code Building logging messages in libraries such as spdlog Formatting dates, times and containers for console output Writing portable C++ code that targets C++20 or older compilers
- Where can I get fmt?
- The source code and installation instructions are on GitHub: https://github.com/fmtlib/fmt
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A cross-platform hex editor for reverse engineering and binary analysis, with a pattern language for parsing file structures.
A cross-platform serialization library that lets you read binary data directly without parsing or unpacking it first.
A free, cross-platform visual tool for creating, browsing, editing and querying SQLite database files without writing SQL.
A C++ JSON parser that uses SIMD instructions to parse gigabytes of JSON per second with full validation.
A free, open-source, cross-platform video editor built with Qt and the MLT multimedia framework.