In Express.js, express.urlencoded() is built-in middleware that parses application/x-www-form-urlencoded request bodies — the format HTML forms send by default — and stores the fields on req.body. It is based on body-parser.
Mount it with app.use()before routes that read the body. Pair it with express.json() when the same app also accepts JSON. It runs on your Express server — not in the browser.
Syntax
Call express.urlencoded in your Express.js app. Start with this line.
Express
express.urlencoded([options])
Call
What it does
express.urlencoded([options])
Primary signature.
Install with npm install express. Create the app with const app = express() before you use this API in an Express.js tutorial project.
Two parsers, two media types. Each middleware only parses requests that match its type.
Same route, same req.body. Handlers do not care which parser ran, as long as the body is populated.
Shared limits.limit: '50kb' caps oversized payloads for both.
Not for file uploads.multipart/form-data needs dedicated upload middleware, not urlencoded.
Compatibility
Runtime Support
express.urlencoded() is Express.js built-in middleware. It runs on a Node.js server (Express 5 needs Node.js 18+). Browsers only submit the form body over HTTP.
✓ Server · Express 4.16+ & 5
express.urlencoded()
Works wherever Express runs: Node.js is the primary target. Bun and Deno can run many Express apps with compatibility layers. Not available in the browser.
ServerNode.js runtime API
Node.js18+ for Express 5 · 14+ typical for Express 4
Supported
BunExpress-compatible server apps
Supported
DenoVia npm compatibility / adapters
Supported
express.urlencoded()Express on Node.js
Bottom line: Study and run these examples with Node.js and the express package. Copy a snippet into a local file and start the server with node.
Frequently Asked Questions
It is built-in middleware that parses application/x-www-form-urlencoded bodies (typical HTML form POSTs) and sets req.body to the parsed fields.
extended: false (Express 5 default) uses the querystring library for flatter keys. extended: true uses qs so nested keys like user[name]=Ada become objects.
Yes, when the same app accepts both HTML forms and JSON APIs. Mount both before routes that read req.body.
Usually the middleware is missing, mounted after the route, or the Content-Type is not urlencoded (for example multipart file uploads need different middleware).
No. It runs on your Node.js server. Browsers only submit the form; the server parses the body.