FastAPI vs Flask: source lines of code compared

As of 2026-05-18, fastapi/fastapi contains 356,870 total lines (113,105 code) across 2,765 files, while pallets/flask contains 34,130 total lines (25,615 code) across 210 files as of 2026-05-18. fastapi/fastapi is about 4.4x the size of pallets/flask by code lines. Code size is not code quality: a larger count only means more source material, not a better or worse project.

Metricfastapi/fastapipallets/flask
Files2,765210
Total lines356,87034,130
Code lines113,10525,615
Comment lines130,691986
Blank lines113,0747,529
Languages counted912

Top languages in fastapi/fastapi: Python (82.8% of code), SVG (11.3% of code), YAML (4.7% of code). Top languages in pallets/flask: Python (54.6% of code), ReStructuredText (42.2% of code), TOML (1.3% of code). Python, CSS appear in both top language lists; SVG, YAML, JavaScript appear only in fastapi/fastapi's top languages; ReStructuredText, TOML, HTML appear only in pallets/flask's top languages.

Methodology: both counts come from cached OctoCounts reports generated with tokei. fastapi/fastapi was counted at ref master (commit 3ab6f1b31df0) on 2026-05-18; pallets/flask was counted at ref main (commit 9fcd34c9f306) on 2026-05-18. See the counting methodology for ignored directories and analysis options.

Evidence and next steps:

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