# Protocol Buffers vs FlatBuffers: source lines of code compared

The Protocol Buffers vs FlatBuffers comparison on OctoCounts shows side-by-side source line counts for protocolbuffers/protobuf and google/flatbuffers, counted with the same engine and analysis options on the dates shown in the methodology line: files, total lines, code lines, comment lines, blank lines, and per-language totals, pinned to the exact commits listed below.

As of 2026-09-16, protocolbuffers/protobuf contains 1,127,860 total lines (871,834 code) across 2,860 files, while google/flatbuffers contains 136,190 total lines (101,824 code) across 593 files as of 2026-09-16. protocolbuffers/protobuf is about 8.6x the size of google/flatbuffers by code lines. Code size is not code quality: a larger count only means more source material, not a better or worse project.

| Metric | [protocolbuffers/protobuf](https://octocounts.com/github/protocolbuffers/protobuf) | [google/flatbuffers](https://octocounts.com/github/google/flatbuffers) |
| --- | ---: | ---: |
| Files | 2,860 | 593 |
| Total lines | 1,127,860 | 136,190 |
| Code lines | 871,834 | 101,824 |
| Comment lines | 135,926 | 19,217 |
| Blank lines | 120,100 | 15,149 |
| Languages counted | 12 | 12 |

Top languages in protocolbuffers/protobuf: C++ (28.8% of code), C# (18.5% of code), C Header (17.0% of code). Top languages in google/flatbuffers: C++ (39.8% of code), C Header (11.6% of code), Rust (10.1% of code). C++, C Header appear in both top language lists; C#, C, Objective-C appear only in protocolbuffers/protobuf's top languages; Rust, Swift, Kotlin appear only in google/flatbuffers's top languages.

Methodology: both counts come from cached OctoCounts reports generated with tokei. protocolbuffers/protobuf was counted at ref fa153cf32201dc5156b320591f2cd9153a7b40b8 (commit fa153cf32201) on 2026-09-16; google/flatbuffers was counted at ref b8431fbcd7a5c71817f314e18b332c0648554efa (commit b8431fbcd7a5) on 2026-09-16. See the [counting methodology](https://octocounts.com/docs/methodology) for ignored directories and analysis options.
## About this comparison

protocolbuffers/protobuf counts the Protocol Buffers repository: the schema compiler, plus runtime libraries for many programming languages. google/flatbuffers counts the FlatBuffers repository — likewise a serialization project with a compiler and multi-language runtime libraries. Both counts therefore span many language runtimes in a single tree, not one library, and were taken on the dates shown above.

The per-language tables are the real story on this page: each repository is a multi-language project, with counted code spread across C++, Java, Python, Go, and other runtime directories, so the totals aggregate implementations for ecosystems a given user may never touch.

Because both projects ship a compiler and language runtimes in one repo, a large share of each count is per-language support code — the same support matrix implemented twice, once per project — rather than serialization logic proper.

_Do not read the totals as one-library-vs-one-library: each number is a bundle of many runtimes. If you use one language, the per-language breakdown above is the only part of the count that describes the code you would actually interact with._

Sources: [protocolbuffers/protobuf repository (compiler and multi-language runtimes)](https://github.com/protocolbuffers/protobuf) · [google/flatbuffers repository (compiler and multi-language runtimes)](https://github.com/google/flatbuffers). Statements verified 2026-09-16.

Evidence and next steps:

- [protocolbuffers/protobuf SLOC report](https://octocounts.com/github/protocolbuffers/protobuf)
- [google/flatbuffers SLOC report](https://octocounts.com/github/google/flatbuffers)
- [Compare protocolbuffers/protobuf and google/flatbuffers interactively](https://octocounts.com/compare?left=https%3A%2F%2Fgithub.com%2Fprotocolbuffers%2Fprotobuf&right=https%3A%2F%2Fgithub.com%2Fgoogle%2Fflatbuffers)

Note: code size is not code quality. OctoCounts only reports reproducible line counts and makes no claim that either project is better.

## Compare FAQ

### Which has more lines of code, protocolbuffers/protobuf or google/flatbuffers?

protocolbuffers/protobuf has more code: 871,834 code lines versus 101,824 for google/flatbuffers, about 8.6x as much, based on cached OctoCounts reports as of 2026-09-16.

### Does more source lines of code mean more complexity?

Not necessarily. SLOC measures size, not complexity, quality, or maintainability. A larger codebase can mean more features, more generated or vendored code, more verbose language idioms, or more tests — none of which imply the code is harder to work with. Use SLOC to gauge the scale of what you'd be reading or maintaining, not as a quality signal for protocolbuffers/protobuf, google/flatbuffers, or any repository.

### How is this comparison calculated?

Methodology: both counts come from cached OctoCounts reports generated with tokei. protocolbuffers/protobuf was counted at ref fa153cf32201dc5156b320591f2cd9153a7b40b8 (commit fa153cf32201) on 2026-09-16; google/flatbuffers was counted at ref b8431fbcd7a5c71817f314e18b332c0648554efa (commit b8431fbcd7a5) on 2026-09-16. See the counting methodology for ignored directories and analysis options.

### Can I compare a different branch, tag, or commit?

Yes. This page shows the default branch for each repository. Use the interactive comparison tool to pick any public GitHub repository, branch, tag, or commit SHA for both sides and get a fresh side-by-side report.

## Related OctoCounts pages

- [Interactive repository comparison](https://octocounts.com/compare)
- [Recently analyzed repositories](https://octocounts.com/recent)
- [Popular SLOC reports](https://octocounts.com/popular)
- [Trending GitHub repositories](https://octocounts.com/trending)
- [Hall of Monoliths](https://octocounts.com/hall-of-monoliths)
- [Original research: how filtering changes SLOC counts](https://octocounts.com/research)
- [GitHub SLOC counter guide](https://octocounts.com/docs/github-sloc-counter)
- [Counting methodology](https://octocounts.com/docs/methodology)
- [SLOC and code metrics glossary](https://octocounts.com/docs/glossary)
- [OctoCounts API docs](https://octocounts.com/docs/api)
