Stage 01 · Write · Researched comparison
Best C++ Serialization Libraries in 2026
Protocol Buffers is the first pick for most teams that need schema-driven, versioned messages across languages. FlatBuffers suits read-heavy systems that need zero-copy access without a parse step. cereal is a good fit for C++-only projects that want a header-only library with no external codegen. All three are open source, so the real cost is build and schema work, not licence fees.
By Shihab Mia
Published 28 Nov 2026 · 7 tools compared
We run no ads and no affiliate links at launch. The order of a list follows our published method. See how we score.
Prices are the starting prices vendors list publicly. Plans change, so confirm the current price on the vendor page before you buy.
Key takeaways
- Protocol Buffers, FlatBuffers, Cap'n Proto and cereal are all free and open source, so selection turns on schema model, wire format and build cost.
- Protocol Buffers and FlatBuffers use a schema and a code generator; cereal and bitsery work directly from C++ types.
- FlatBuffers and Cap'n Proto allow zero-copy reads, which matters when parsing latency is the bottleneck.
- None of these are web tools, but any generated schema or config you paste into an online viewer should not contain production secrets.
Who each pick is for
- Cross-language, schema-driven message exchangeProtocol Buffers
- Zero-copy reads of large or frequent messagesFlatBuffers
- Zero-copy RPC and IPC with schema evolutionCap'n Proto
- Header-only C++ projects with no codegen stepcereal
- Projects already using Boost that need object graphsBoost.Serialization
- Compact binary format with a simple data modelMessagePack for C++ (msgpack-c)
- Header-only binary serialization with tight size controlbitsery
Comparison
| Tool | Best for | Standout feature | Listed starting price | Free plan or trial |
|---|---|---|---|---|
| 1Protocol Buffers | Cross-language, schema-driven message exchange | Mature schema language and codegen for many languages | Free (open source) | Free plan |
| 2FlatBuffers | Zero-copy reads of large or frequent messages | Access fields directly from the buffer with no parse step | Free (open source) | Free plan |
| 3Cap'n Proto | Zero-copy RPC and IPC with schema evolution | Zero-copy reads plus a built-in RPC protocol | Free (open source) | Free plan |
| 4cereal | Header-only C++ projects with no codegen step | Header-only with no external dependencies | Free (open source) | Free plan |
| 5Boost.Serialization | Projects already using Boost that need object graphs | Handles pointers, containers and object graphs | Free (open source) | Free plan |
| 6MessagePack for C++ (msgpack-c) | Compact binary format with a simple data model | Schema-less binary format with implementations in many languages | Free (open source) | Free plan |
| 7bitsery | Header-only binary serialization with tight size control | Header-only with no dependencies | Free (open source) | Free plan |
How we picked
We compared libraries on fit for common C++ serialization jobs: schema-driven versus type-driven design, zero-copy read support, cross-language reach, platform coverage, licence terms and known limits such as codegen steps or archive portability. Sources are vendor documentation, project repositories and public licence pages. Prices and licences can change, so confirm details on the vendor site before committing.
The tools, one by one
Protocol Buffers
Best for cross-language, schema-driven message exchange

What it is and where it fits
Protocol Buffers, usually called protobuf, defines messages in .proto files and generates C++ classes from them. The wire format is compact and supports adding or removing fields without breaking older readers. It ships with the official protoc compiler and a C++ runtime, and it runs on Linux, macOS and Windows. The project is open source under a BSD-style licence with no paid tier.
The main cost is the workflow: you maintain schema files, run codegen, and rebuild when schemas change. Decoding builds full message objects, so it is not a zero-copy format. Skip protobuf if you need to read single fields from a large buffer without materializing the whole message, or if your project cannot add a codegen step.
Standout: Mature schema language and codegen for many languages
Free (open source), as listed by the vendor (Protocol Buffers website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Mature schema language and codegen for many languages
- compact binary wire format with field-level versioning
Drawbacks
- Requires a build step and generated code
- parsing allocates objects before you can read fields
Skip it if this limit matters to you: requires a build step and generated code.
Verdict. A sensible pick for cross-language, schema-driven message exchange.
Alternatives in this guide: FlatBuffers, Cap'n Proto, cereal
FlatBuffers
Best for zero-copy reads of large or frequent messages

What it is and where it fits
FlatBuffers stores data in a flat binary buffer that you can read in place. Generated accessors return fields without deserializing the whole object, which helps when you read a few fields from many messages. Schemas are written in an IDL and compiled with flatc, which also generates C++ headers. It is open source under Apache 2.0 and runs on major desktop and mobile platforms.
The tradeoff is size and ergonomics. Buffers are often larger than protobuf output, and building them requires more code. It is a poor fit for write-heavy pipelines where every message is fully consumed once. It is a strong fit for game data, caches and IPC where reads dominate.
Standout: Access fields directly from the buffer with no parse step
Free (open source), as listed by the vendor (FlatBuffers website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Access fields directly from the buffer with no parse step
- supports schema evolution and many languages
Drawbacks
- Builder API is more verbose
- buffers are larger than protobuf for small messages
Skip it if this limit matters to you: builder API is more verbose.
Verdict. A sensible pick for zero-copy reads of large or frequent messages.
Alternatives in this guide: Protocol Buffers, Cap'n Proto, cereal
Cap'n Proto
Best for zero-copy RPC and IPC with schema evolution

What it is and where it fits
Cap'n Proto uses a schema and code generator like protobuf, but reads happen directly on the wire buffer. It also includes an RPC layer, so the same schema covers messages and remote calls. The project is open source under the MIT licence and builds on Linux, macOS and Windows. The C++ implementation is the reference one.
Its ecosystem is smaller than protobuf's, and generated code and tooling assume C++ first. If your team is already standardized on protobuf or gRPC, switching has limited payoff. Choose Cap'n Proto when you control both ends and want zero-copy reads with RPC in one package.
Standout: Zero-copy reads plus a built-in RPC protocol
Free (open source), as listed by the vendor (Cap'n Proto website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Zero-copy reads plus a built-in RPC protocol
- schema evolution rules are explicit
Drawbacks
- Smaller ecosystem than protobuf
- C++ is the primary target language
Skip it if this limit matters to you: smaller ecosystem than protobuf.
Verdict. A sensible pick for zero-copy RPC and IPC with schema evolution.
Alternatives in this guide: Protocol Buffers, FlatBuffers, cereal
cereal
Best for header-only C++ projects with no codegen step

What it is and where it fits
cereal is a header-only C++11 library for serializing user types to binary, XML or JSON archives. You add a serialize function to your types and pick an archive type. There is no schema file and no code generator, which keeps the build simple. It is open source under a BSD licence and works with any conforming C++11 compiler.
The limits follow from that design. The format is C++-specific, so other languages cannot read it without matching your layout. Compile times grow with heavy template use. cereal fits internal persistence, save files and test fixtures. It does not fit public APIs that non-C++ clients must consume.
Standout: Header-only with no external dependencies
Free (open source), as listed by the vendor (cereal website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Header-only with no external dependencies
- supports binary, XML and JSON archives
Drawbacks
- C++ only, so it does not help cross-language boundaries
- templates increase compile times
Skip it if this limit matters to you: C++ only, so it does not help cross-language boundaries.
Verdict. A sensible pick for header-only C++ projects with no codegen step.
Alternatives in this guide: Protocol Buffers, FlatBuffers, Cap'n Proto
Boost.Serialization
Best for projects already using Boost that need object graphs

What it is and where it fits
Boost.Serialization is part of the Boost C++ libraries. It serializes complex object graphs, including pointers and standard containers, to text, binary or XML archives. If your project already depends on Boost, adding it costs little. It is open source under the Boost Software License and builds on the platforms Boost supports.
Portability is the catch. Binary archives depend on type layout and endianness, so they are not a stable interchange format between different builds. Versioning is supported through class version numbers, but it needs care. Skip it if you want a small standalone dependency or cross-language data exchange.
Standout: Handles pointers, containers and object graphs
Free (open source), as listed by the vendor (Boost.Serialization website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Handles pointers, containers and object graphs
- part of the widely used Boost libraries
Drawbacks
- Tied to the Boost release cycle
- binary archives are not portable across compiler or platform changes
Skip it if this limit matters to you: tied to the Boost release cycle.
Verdict. A sensible pick for projects already using Boost that need object graphs.
Alternatives in this guide: Protocol Buffers, FlatBuffers, Cap'n Proto
MessagePack for C++ (msgpack-c)
Best for compact binary format with a simple data model

What it is and where it fits
msgpack-c implements the MessagePack binary format for C++. MessagePack is schema-less and maps to common types like maps, arrays and numbers, so it is easy to adopt and has implementations in many languages. The C++ library is header-only for the core API and open source under the Boost Software License.
Because there is no schema, both sides must agree on structure by convention, and mismatches surface at runtime. The C++ API changed between major versions, so check which branch your dependency manager pulls. It fits logging, caching and internal messaging where JSON is too large but a schema is overkill.
Standout: Schema-less binary format with implementations in many languages
Free (open source), as listed by the vendor (MessagePack for C++ (msgpack-c) website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Schema-less binary format with implementations in many languages
- smaller payloads than JSON
Drawbacks
- No schema means no compile-time contract
- C++ API has changed across major versions
Skip it if this limit matters to you: no schema means no compile-time contract.
Verdict. A sensible pick for compact binary format with a simple data model.
Alternatives in this guide: Protocol Buffers, FlatBuffers, Cap'n Proto
bitsery
Best for header-only binary serialization with tight size control

What it is and where it fits
bitsery is a header-only C++ binary serialization library. It serializes types through extension functions and lets you control field sizes and bit packing, which helps when wire size matters. It has no external dependencies and is open source under the MIT licence. It builds with C++11 and later compilers.
The tradeoffs are reach and maturity. It is C++ only, so other languages need a matching reader, and the community is smaller than the larger projects. It fits embedded and size-sensitive internal formats. For cross-team or cross-language contracts, a schema-based library is usually the safer choice.
Standout: Header-only with no dependencies
Free (open source), as listed by the vendor (bitsery website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Header-only with no dependencies
- supports fine-grained control over bit-level layout
Drawbacks
- Smaller community than protobuf or cereal
- C++ only with no cross-language readers
Skip it if this limit matters to you: smaller community than protobuf or cereal.
Verdict. A sensible pick for header-only binary serialization with tight size control.
Alternatives in this guide: Protocol Buffers, FlatBuffers, Cap'n Proto
Who should use what
If your messages cross language boundaries and need versioning, start with Protocol Buffers. If reads dominate and you want to avoid a parse step, look at FlatBuffers or Cap'n Proto, with Cap'n Proto also covering RPC. If your project is C++ only and you want no codegen, cereal is the simplest starting point, and bitsery helps when wire size is tight. Teams already on Boost can use Boost.Serialization for object graphs, and msgpack-c fits schema-less internal messaging where JSON is too large.
Questions to settle before you buy
What to check before you buy
- Confirm whether you need a schema and codegen step or can serialize C++ types directly.
- Check that the wire format is stable across compiler, platform and endianness changes.
- Verify how the library handles schema evolution and unknown fields.
- Measure whether zero-copy reads matter for your access pattern before adding complexity.
- Review the licence and the maintenance activity of the repository before adopting it.
FAQ
Do I need a schema to use these libraries?
No. Protocol Buffers, FlatBuffers and Cap'n Proto use schemas. cereal, bitsery and msgpack-c serialize C++ types or generic data without one. Schema-based libraries give stronger cross-language contracts; schema-less ones are faster to set up.
Which library is fastest for reading?
FlatBuffers and Cap'n Proto are designed for zero-copy reads, so they avoid building objects before access. Actual speed depends on your data and access pattern. Test with your own messages rather than relying on general claims.
Can these libraries exchange data with other languages?
Protocol Buffers, FlatBuffers, Cap'n Proto and MessagePack have implementations in many languages. cereal and bitsery are C++ only, so other languages need a matching reader for your layout.
Are any of these libraries paid?
All the libraries listed here are free and open source. Costs come from integration work, build tooling and maintenance, not licence fees.
Is it safe to paste schema files into online tools?
Schema files can reveal internal data structures. Avoid pasting production schemas or configs into third-party web pages, and prefer local or offline tooling where available.
Sources we checked
Method: how we score · editorial policy.
Change log. First published 28 Nov 2026.