FastAPI is the default for a new API service, and Flask remains the better fit for an app that renders HTML or an API that already works. How much faster FastAPI is depends on what the handler waits on: Pynions’ summary of the Manjusaka benchmark puts the gap at roughly 2x when Flask is gevent-patched and queries a real MySQL database, while Uvik’s single-worker I/O test reported 7.8x (150 against 19 requests per second).
The install-day facts, checked on 13 November 2026: the FastAPI release notes list 0.162.5 on 11 November 2026, and FastAPI is still a 0.x project. Flask’s stable changelog lists 3.1.3 on 18 February 2026, and the latest docs list Version 3.2.0 above 3.1.3. Flask’s installation page recommends “the latest version of Python”, not a fixed 3.12.
Don't miss new tech stories on Google
Add Tech Insider once in the Google app and our stories appear in your news suggestions.
Why the published speed-up runs from 2x to 7.8x
A single multiplier misleads, because each published figure comes from a different workload. The table sets every sourced result beside the conditions that produced it.
| Source and setup | Reported result | What to take from it |
|---|---|---|
| Uvik: one worker per framework, I/O-bound load | About 150 against 19 requests per second, reported as 7.8x | The best case for FastAPI, where each request mostly waits. Uvik says FastAPI’s single worker also beat Flask running four workers. |
| Manjusaka benchmark via Pynions: synthetic async I/O where Flask threads block on simulated latency | 4 to 7x | Applies when your waits behave like simulated delays. Pynions notes this is where the larger figures come from. |
| Same benchmark: real MySQL queries, gevent-patched Flask | Roughly 2x | The lowest published figure, and the closest to a CRUD service backed by a database. |
| Pynions: aggregating three external APIs, each with 1 second latency | About 3 seconds in synchronous Flask, about 1 second in FastAPI using asyncio.gather | A latency ratio, not a throughput ratio. The saving comes from overlapping the three calls. |
The quoted request rates are rounded: 150 divided by 19 gives 7.9, against the 7.8x the source reports. The fan-out result is a latency figure rather than a throughput ratio, so it is not comparable with the other three.
FastAPI’s benchmarks page explains why the framework itself is not the source of the gap: “FastAPI uses Starlette, so it cannot be faster than it.” It adds that independent TechEmpower results place FastAPI under Uvicorn among the fastest Python frameworks, below only Starlette and Uvicorn, and it advises comparing Starlette against frameworks such as Flask. Uvik gives the structural difference: WSGI handles one request per thread and blocks on I/O, while ASGI runs a single event loop that awaits many I/O operations concurrently. The multiplier therefore tracks how much of a request is spent waiting, which fits the largest figures coming from the synthetic and single-worker tests. The smallest figure used gevent-patched Flask, which also overlaps waits, so that lower gap reflects the setup as well as the workload.
Two cautions apply in both directions. Pynions warns that “writing async def without a fully async I/O stack doesn’t improve performance. It can hurt performance instead.” Uvik adds that synchronous database drivers, HTTP clients and file operations can still block the event loop inside a FastAPI handler. On the Flask side, its async documentation says the number of requests the app can handle at one time stays the same with async views and that “Async is not inherently faster than sync code.” Adding async to Flask is not the same as moving to an event-loop framework.
Sizing it: in-flight requests equal arrival rate times seconds spent waiting
Little’s law says the number of requests in flight equals the arrival rate multiplied by the time each request spends in the system. For a handler that mostly waits on upstream calls, that gives the number of concurrent slots you need. Under synchronous Flask each in-flight request holds a worker, and the calls in one request run one after another, so the wait is their sum. With asyncio.gather the calls overlap, so the wait is the longest single call, and the in-flight requests sit on one event loop. The inputs below are our own hypotheticals, apart from the three-call, 1,000 ms case taken from Pynions, where the rate is our assumption. The table is calculated from that formula, not measured.
| Scenario | Requests per second | Upstream calls per request | In flight, calls in sequence | In flight, calls overlapped |
|---|---|---|---|---|
| Aggregation handler, hypothetical | 200 | 3 calls of 100 ms | 60 (300 ms per request) | 20 (100 ms per request) |
| Pynions fan-out case, rate assumed | 10 | 3 calls of 1,000 ms | 30 (3,000 ms per request) | 10 (1,000 ms per request) |
| Single database call, hypothetical | 400 | 1 call of 50 ms | 20 (50 ms per request) | 20 (50 ms per request) |
| Five slow upstream calls, hypothetical | 50 | 5 calls of 200 ms | 50 (1,000 ms per request) | 10 (200 ms per request) |
The slot saving equals the number of independent calls: three times fewer for the first two rows, five times for the last, and none when there is only one wait. That fits the pattern in the first section, where the gap is smallest with real database queries and the fan-out case shows the clearest latency saving. If your handler is mostly computation, the calculation does not apply.
For cost, measure the sustained requests per second one instance holds under a load that resembles your traffic, then use: monthly instance price divided by (sustained requests per second x 2,592,000 seconds in a 30-day month x target utilisation), multiplied by 1,000,000. Example with hypothetical inputs: $50 a month, 500 requests per second sustained and 50% utilisation gives 500 x 2,592,000 x 50% = 648,000,000 requests a month, so $50 divided by 648 is about $0.077 per million requests. Run it once per framework with your measured rates rather than borrowing anyone’s platform table.
One item API, two frameworks: where the validation code goes
The same small item API in both frameworks, create, fetch by id and list with a filter, using an in-memory dict as the store so the validation code stays in view:
# FastAPI: the model is the validation and the schema
import uuid
from typing import Dict, List
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel, Field
app = FastAPI()
items_db: Dict[str, dict] = {}
class ItemCreate(BaseModel):
name: str = Field(min_length=1, max_length=100)
price: float = Field(gt=0)
in_stock: bool = True
class ItemResponse(BaseModel):
id: str
name: str
price: float
in_stock: bool
@app.post("/items/", response_model=ItemResponse, status_code=201)
async def create_item(item: ItemCreate):
item_id = str(uuid.uuid4())
item_data = {"id": item_id, **item.model_dump()}
items_db[item_id] = item_data
return ItemResponse(**item_data)
@app.get("/items/{item_id}", response_model=ItemResponse)
async def get_item(item_id: str):
if item_id not in items_db:
raise HTTPException(status_code=404, detail="Item not found")
return ItemResponse(**items_db[item_id])
@app.get("/items/", response_model=List[ItemResponse])
async def list_items(in_stock_only: bool = False):
items = list(items_db.values())
if in_stock_only:
items = [item for item in items if item["in_stock"]]
return [ItemResponse(**item) for item in items]
# Flask: each rule is written by hand
import uuid
from flask import Flask, jsonify, request
app = Flask(__name__)
items_db = {}
@app.post("/items/")
def create_item():
data = request.get_json(silent=True) or {}
name = data.get("name")
if not isinstance(name, str) or not 1 <= len(name) <= 100:
return jsonify(error="name must be 1 to 100 characters"), 400
try:
price = float(data["price"])
except (KeyError, TypeError, ValueError):
return jsonify(error="price must be a number"), 400
if price <= 0:
return jsonify(error="price must be positive"), 400
in_stock = data.get("in_stock", True)
if not isinstance(in_stock, bool):
return jsonify(error="in_stock must be true or false"), 400
item_id = str(uuid.uuid4())
item_data = {"id": item_id, "name": name, "price": price, "in_stock": in_stock}
items_db[item_id] = item_data
return jsonify(item_data), 201
@app.get("/items/<item_id>")
def get_item(item_id):
if item_id not in items_db:
return jsonify(error="Item not found"), 404
return jsonify(items_db[item_id])
@app.get("/items/")
def list_items():
in_stock_only = request.args.get("in_stock_only", "false").lower() == "true"
items = list(items_db.values())
if in_stock_only:
items = [item for item in items if item["in_stock"]]
return jsonify(items)
Pynions’ illustration of the same gap is that an endpoint that rejects wrong types takes 20+ lines with marshmallow where a Pydantic model needs 5. That is the source’s illustration, not a measurement of ours. HighCircl names a need for generated clients, along with contract drift and async fan-out, among the costs that can outweigh a migration. FastAPI additionally ships an official skill for coding agents that matches your installed version; the release notes say to install it with uvx library-skills from your project directory.
Python floors, the 0.x pin and the changes that can break an upgrade
| Item | FastAPI | Flask |
|---|---|---|
| Latest release in the vendor’s notes | 0.162.5, 11 November 2026 | 3.1.3, 18 February 2026 in the stable changelog; the latest docs list 3.2.0 above it |
| Python requirement | 3.10 or newer, per HighCircl; 3.15 supported since 0.162.3 (10 November 2026) | Installation page recommends the latest Python. Stable docs (3.1.x): 3.9 and newer. Latest docs (3.2.x): 3.11 and newer |
| Interface and servers | ASGI, per Uvik. The benchmarks page describes FastAPI applications running under Uvicorn, and the changelog added Hypercorn to the docs as an alternative ASGI server | WSGI, per Uvik |
| Concurrency model | Single event loop awaiting many I/O operations | One request per thread; async views still tie up a worker |
| Validation | Pydantic models | Manual checks or an extension such as marshmallow, per Pynions |
| API documentation | Automatic OpenAPI 3.1 docs (Swagger UI and ReDoc), per Uvik | Via extensions such as Flasgger, per Uvik |
| First released | 2018 (Sebastian Ramirez), per Uvik | 2010 (Armin Ronacher), per Uvik |
| Licence | MIT | BSD-3-Clause, per Flask’s license page |
The Python devguide lists 3.10 as reaching end of life on 1 October 2026, as HighCircl also notes, which makes FastAPI’s floor an expired interpreter. A new FastAPI service should therefore start on a newer Python than 3.10. Flask 3.1.0, released 13 November 2024, dropped Python 3.8 and, per the config docs, added SECRET_KEY_FALLBACKS (key rotation).
Pin FastAPI. HighCircl quotes the framework’s versioning policy: “any version below 1.0.0 could potentially add breaking changes.” In a requirements file:
# exact pin
fastapi==0.162.5
# or accept later 0.162 patch releases only
# fastapi~=0.162.5
Changes to check before moving between recent releases:
- 0.155.0 (20 October 2026): the deprecated
**extrakeyword arguments were removed from Path, Query, Header, Cookie, Body, Form and File (commit). Unknown keyword arguments now raise TypeError. The change landed in 0.155.0, earlier than the 0.162 series pinned above (checked 13 November 2026). - 0.162.0 (FastAPI release): “FastAPI no longer infers False for omitted booleans. This applies to individual form parameters, form models, and unions of form models.” Any form field that relied on the False default needs an explicit default.
- 0.162.5 (11 November 2026): a fix for synchronous dependency cleanup on cancellation.
- Flask 3.1.3 (18 February 2026): a security fix (GHSA-68rp-wp8r-4726) so the session is marked as accessed for operations that only read keys, such as
inandlen. Flask 3.1.x apps should take it, and the latest docs now list 3.2.0 above it.
Adoption: what the download tables and developer surveys report
| Source | FastAPI monthly PyPI downloads | Flask monthly PyPI downloads | Who leads |
|---|---|---|---|
| Pynions | 478 to 492 million | 192 to 201 million | FastAPI, a 2.4x run-rate per Pynions |
| Uvik | About 9 million | About 40 million | Flask |
The two pages differ by an order of magnitude and name opposite leaders, so neither set of counts should decide the choice. The survey figures below are the sturdier guide to adoption.
The survey figures come from named studies. Uvik cites JetBrains’ State of Python 2025 for FastAPI use growing from 29% to 38% of Python developers in one year, the largest gain among Python web frameworks. HighCircl reports that in the Stack Overflow 2025 survey, among all 23,678 respondents, 14.8% said FastAPI, 14.4% Flask and 12.6% Django, and it cautions that the FastAPI-Flask gap may be noise.
Moving a working Flask API: mount it, then port the routes that fan out
HighCircl gives the sharpest test for staying put: “Stay on Flask unless contract drift, async fan-out or a need for generated clients costs you more than a migration would.” Its suggested incremental route is to mount the existing Flask app inside FastAPI through WSGIMiddleware, then rewrite routes one at a time.
A workable porting order, drawn from the sections above: port first the handlers that await several upstream calls, since the slot saving equals the number of calls, and the handlers whose request or response shape has drifted. Leave plain CRUD and HTML-rendering routes on Flask, where the published gap with real queries is about 2x and a port means re-testing.
- Search each ported handler for blocking calls inside
async def: synchronous database drivers, HTTP clients and file operations still block the event loop. - Check every form field against the 0.162.0 boolean change.
- Pin to a 0.162 release and read the release notes before each bump.
- Keep the Flask side on 3.1.3 or later while it still serves traffic.
For building the FastAPI side from scratch, our FastAPI REST API tutorial covers the setup. Teams whose real need is an admin interface and an ORM rather than either micro-framework can compare our Django REST Framework tutorial.
Choosing by workload
| Workload | Pick | Evidence | What you give up |
|---|---|---|---|
| New API that fans out to several upstream services | FastAPI | About 3 seconds against about 1 second for three 1-second calls; 4 to 7x synthetic; 7.8x single worker | Pinning and breaking-change upkeep while FastAPI is 0.x |
| New API with simple database queries | Either; FastAPI if you want validation built in | Roughly 2x with real MySQL queries and gevent-patched Flask | Flask: hand-written validation. FastAPI: the 0.x upkeep |
| Existing Flask API that works | Stay on Flask | HighCircl’s stay-put test | Latency stays at the sum of the waits in fan-out handlers |
| App that renders HTML pages | Flask | Judgment rather than a sourced figure: FastAPI’s draw is validation, which a page-rendering app does not use | Hand-built validation if you add JSON endpoints later |
| Small internal tool or script endpoint | Flask | No waiting to overlap, and Flask’s docs say async is not inherently faster | Integrated validation |
| Team that wants typed contracts and generated clients | FastAPI | HighCircl lists contract drift and generated clients as reasons to move | Pinning and breaking-change upkeep |
| Estate staying on Python 3.9 | Flask 3.1.x | Stable Flask docs say 3.9 and newer; FastAPI needs 3.10 or newer per HighCircl | Flask 3.2.x docs say 3.11 and newer, so plan an interpreter upgrade |
Start new API services on FastAPI, pinned to a 0.162 release, and keep Flask for apps that render HTML, already work, or have no waiting to overlap.





