Flask-WTF
Form rendering, validation, and CSRF protection for Flask with WTForms.
What it is and what it does
Flask-WTF is a Flask extension that bridges Flask and WTForms to simplify form handling in web applications. It provides built-in CSRF protection, form rendering, validation, and support for file uploads and reCAPTCHA integration. The package wraps WTForms functionality with Flask-specific conveniences, letting developers define form classes declaratively and validate user input with minimal boilerplate.
It depends on Flask, WTForms, and itsdangerous (for secure token handling). The package is production-stable, actively maintained, and widely used across Flask projects. It requires Python 3.10 or later and is designed to work seamlessly within Flask's application context and request lifecycle.
Use it for:
- Build login and registration forms with built-in CSRF tokens and field validation.
- Handle file uploads in forms with automatic validation and security checks.
- Protect web forms against cross-site request forgery attacks automatically.
- Integrate reCAPTCHA into forms to prevent automated abuse.
- Render and validate multi-field forms with custom validators and error messages.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Flask-WTF integrates WTForms with Flask to handle form rendering, validation, and CSRF protection in web applications.
Yes. Flask-WTF is production-stable, actively maintained, has low install friction, carries no known vulnerabilities, and is the standard form-handling solution for Flask applications. Install it if you are building forms in Flask.
Install
flask-wtf on PyPI
pip
pip install flask-wtfuv
uv add flask-wtfpoetry
poetry add flask-wtfInstalling Flask-WTF
Before you install
Low friction install with three straightforward runtime dependencies. Active maintenance with a recent release (113 days ago) and ongoing repository activity.
License in practice
BSD license permits commercial and private use with minimal restrictions—retain the license notice and disclaimer in distributions.
Quickstart
pip install Flask-WTF
from flask import Flask
from flask_wtf import FlaskForm
from wtforms import StringField
from wtforms.validators import DataRequired
app = Flask(__name__)
app.config['SECRET_KEY'] = 'your-secret-key'
class MyForm(FlaskForm):
name = StringField('Name', validators=[DataRequired()])
@app.route('/', methods=['GET', 'POST'])
def index():
form = MyForm()
if form.validate_on_submit():
return f"Hello {form.name.data}"
return form.render()
Requires Python 3.10 or later and a Flask application context to function.
Verify before relying
- Whether reCAPTCHA integration requires additional API keys or configuration beyond what Flask-WTF provides.
- File upload size limits and supported storage backends for uploaded files.
Package facts
| License | Copyright 2010 WTForms Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — flask, itsdangerous, wtforms |
| Maintenance | actively maintained — 113 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 20,213,009/month — #1,043 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: flask_wtf-1.3.0-py3-none-any.whl
Tags
More Application Frameworks packages
FastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
textualTextual is a Python framework for building…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
mcpBuild and connect to Model Context Protocol…
permissive · top 1,000 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
Flask-ParanoidFlask-Paranoid detects and blocks session…
permissive · top 15,000 on PyPI
WTFormsWTForms provides form validation, rendering,…
permissive · top 5,000 on PyPI
FlaskFlask is a lightweight WSGI web application…
permissive · top 1,000 on PyPI
WTForms-ComponentsExtends WTForms with additional field types,…
permissive · top 15,000 on PyPI
Bootstrap-FlaskBootstrap-Flask provides Jinja macros that…
permissive · top 15,000 on PyPI
WTForms-JSONAdds JSON parsing and validation support to…
permissive · top 15,000 on PyPI
Flask-AutoIndexFlask-AutoIndex generates directory listing…
permissive · top 15,000 on PyPI
flask-mongoengineFlask-MongoEngine integrates MongoEngine…
permissive · top 15,000 on PyPI
django-recaptchaIntegrates Google reCAPTCHA (V2 Checkbox, V2…
permissive · top 15,000 on PyPI
Flask-SecurityFlask-Security adds authentication,…
permissive · top 15,000 on PyPI