fmt: Format C++ Text Safely and Efficiently

Summary
{fmt} is a C++ formatting library for producing text and output without relying on C stdio or iostreams. It suits projects that need a type-safe, portable formatting API, with optional compile-time format checks and a header-only mode.
At a glance
- Language
- C++
- License
- MIT
- Stars
- 25.9k
- Forks
- 3.1k
- Added to OSRepos
- November 18, 2025
- Last analyzed
- October 3, 2026
Topics
Click on any tag to explore related repositories
Use at your own risk
OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.
Overview
{fmt} is a C++ library for formatting values into strings and writing formatted output. It offers an alternative to C stdio and iostreams, with a Python-like format syntax and type-safe argument handling.
It is useful when an application needs consistent formatting across platforms, support for custom types, or control over formatting performance and compile-time checks. The project also implements C++20 std::format and C++23 std::print interfaces.
Key Features
- Format strings and print output using positional or automatic arguments.
- Support for compile-time format-string checks in C++20.
- Format numbers, dates, times, ranges, Unicode text, colors, and user-defined types.
- Provide a safe
printf-style API, including positional arguments. - Offer an optional header-only configuration with
FMT_HEADER_ONLY. - Include tests and continuous fuzzing, according to the project README.
Use Cases
- C++ application developers can use it to format strings and console output with type-checked arguments.
- Library authors can add formatting support for custom types through the extension API.
- Teams targeting multiple platforms can use it for consistent formatting behavior and Unicode support.
- Performance-sensitive applications can evaluate it as an alternative to iostreams or stdio for formatting workloads.
- Projects that want to adopt familiar standard formatting interfaces can use its
std::formatandstd::printimplementations.
Project Facts
- Language: C++
- License: MIT
- Stars: 25.9k
- Forks: 3.1k
- Topics: c-plus-plus, chrono, cpp, cross-platform, floating-point, formatting, multiplatform, output, performance, printf, ranges, unicode
- Archived: No
Getting Started
See the README and documentation for installation and build instructions. A basic example is:
#include <fmt/core.h>
int main() {
fmt::print("Hello, world!\n");
}
Considerations
- This is a C++ library, so using it requires a C++ project and a compatible compiler. The README describes support for older compilers but does not list requirements here.
- Header-only use is optional. Projects can instead build and link the library.
- Performance depends on the workload and environment. Consult the linked benchmarks and methodology before choosing it on performance grounds.
Found this useful?
Share it with someone who would like fmt.
Source repository
Open the original repository on GitHub.
22 counted GitHub visits
Related repositories
Similar repositories that may be relevant next.

agent.cpp: Build Local AI Agents in C++
September 3, 2026
agent.cpp is a C++ library for building agents that run small language models locally through llama.cpp. It provides an agent loop, tools, callbacks, and support for GGUF models, grammar constraints, and LoRA adapters.

ACM-ICPC-Algorithms: Competitive Programming Algorithms
July 16, 2026
A collection of algorithms and data structures for competitive programming, organized by topic. It is useful for ICPC participants and programmers looking for reference implementations across common contest problems.

awesome-competitive-programming: Find Contest Learning Resources
July 16, 2026
A curated directory of resources for competitive programming, algorithms, and data structures. Use it to find study materials, practice platforms, contest tools, and communities in one place.

CompetitiveCode: Explore Competitive Programming Problems and Solutions
July 16, 2026
CompetitiveCode is a community collection of interesting programming challenges and documented solutions organized by source or topic. It is useful for learners practicing algorithms and contributors sharing solutions in several programming languages.