In Express.js, req.body holds key-value pairs from the HTTP request body. By default it is undefined. Body-parsing middleware such as express.json() or express.urlencoded() fills it in.
Use it on POST, PUT, and PATCH routes after the parsers are registered with app.use(). It is a server-side property on the request object — browsers only send the raw body.
Syntax
Read req.body in your Express.js route handler. Start with this line.
Use urlencoded middleware.extended: true supports richer form shapes when needed.
Serve a form.method="POST" posts field names as body keys.
Read req.body.email. The parser turns the encoded string into an object.
Validate before use. A quick check avoids treating missing or odd values as safe strings.
Compatibility
Runtime Support
req.body is an Express.js request property filled by server middleware. It runs on Node.js (Express 5 needs Node.js 18+). Browsers only send the HTTP body.
✓ Server · Express 4 & 5
req.body
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
req.bodyExpress on Node.js
Bottom line: Study and run these examples with Node.js and the express package. Always mount a body parser before reading req.body.
Frequently Asked Questions
It holds key-value pairs from the request body after body-parsing middleware runs. By default it is undefined until you add express.json() or express.urlencoded().
Usually the parser middleware is missing, registered after the route, or the Content-Type does not match (for example sending JSON without express.json()).
Call app.use(express.json()) before your routes. It parses Content-Type application/json into a JavaScript object on req.body.
Use app.use(express.urlencoded({ extended: true })) for application/x-www-form-urlencoded form submissions.
No. It is user-controlled. Validate types and required fields before use — never assume req.body.foo.toString() will work.