< HTTP/1.1 204 No Content204 No Content
The request succeeded with no response body. Learn when to use 204 No Content for successful operations that don't return data.
- Cacheable
- Yes, by default
- Client action
- Nothing to read; keep the current view
- Usually sent by
- Origin app
- Spec
- RFC 9110 §15.3.5
- Often confused with
- 200
On this page
TL;DR: 204 No Content means the request succeeded and there is deliberately no body. It is the usual answer to DELETE, to PUT/PATCH when you do not echo the resource, and to CORS preflights. It cannot carry content, so a 204 with a body is a bug.
What it means
DELETE /api/items/42 HTTP/1.1
Host: api.example.com
HTTP/1.1 204 No Content
Date: Sun, 04 Oct 2026 12:00:00 GMT
RFC 9110 section 15.3.5: a 204 ends after the header section. Servers must not send Content-Length or Transfer-Encoding on a 204 (RFC 9110 section 8.6 and RFC 9112 section 6.3). Clients with a page open stay on it; a browser form submission that returns 204 leaves the user on the current page without navigating, which can be a useful way to handle “save” actions that do not need a new view.
When to use it
- DELETE that succeeded.
- PUT or PATCH when the client already has the new state (add an
ETagso it can track the new version). - CORS preflight (OPTIONS) responses; most CORS middleware sends 204, and browsers accept any 2xx.
- Beacons and analytics endpoints (
navigator.sendBeaconignores the response, so 204 saves bytes). - Not for GET of an existing resource that happens to be empty; return 200 with
[]or{}, since clients treat a missing body as a parsing case.
Common bugs
response.json()throws on 204.fetch(...).then(r => r.json())fails withSyntaxError: Unexpected end of JSON input. Checkr.status === 204before parsing. Axios returnsdata: ''.- Body written anyway. Node’s
httpmodule and Express drop the body on a 204, so the client never sees it. On a raw socket, a stray body would be parsed as the start of the next response. - 204 in place of 404. A 204 on a GET for a missing item hides the error. Use 404.
Implementation
Express
app.delete('/api/items/:id', async (req, res) => {
await db.items.delete(req.params.id)
res.sendStatus(204)
})
Flask
@app.delete("/api/items/<int:item_id>")
def delete_item(item_id):
db.delete(item_id)
return "", 204
Go
w.WriteHeader(http.StatusNoContent)
nginx
location = /beacon {
return 204;
}
Reproduce with curl
curl -si -X DELETE https://api.example.com/api/items/42
# HTTP/2 204
# (no body, no content-length)
204 vs 200 vs 201 vs 205
| Code | Body | Meaning |
|---|---|---|
| 200 | Yes | Success with a result |
| 201 | Usual | New resource created |
| 204 | Never | Success, nothing to show |
| 205 | Never | Success, tell the UI to reset the form or view |
Related
See also the comparison 200 vs 201 vs 204: choosing the right success code for create, read, update and delete.
Frequently asked questions
What does 204 No Content mean?
A 204 response means the request succeeded but there is no content to return. The server processed the request successfully and intentionally returns an empty body.
When should I use 204 vs 200?
Use 204 when the operation succeeds but there is nothing meaningful to return. Use 200 when you have data to send back. 204 is common for DELETE and some PUT operations.
Can 204 have a response body?
No, 204 must not include a response body. If you need to return data, use 200 OK instead. The 204 status explicitly means no content.
What is the difference between 204 and 404?
204 means success with no content to return. 404 means the resource was not found. 204 is a success code; 404 is an error code.
Sources
Related
200 vs 201 vs 204: Which Success Code to Return
Choose between 200 OK, 201 Created and 204 No Content for REST APIs: what each means, the Location and body rules, raw responses for POST, PUT, PATCH and DELETE.
202 Accepted
The request was accepted for processing but not completed yet. Learn when to use 202 for asynchronous operations.
203 Non-Authoritative Information
203 means a proxy modified the origin response before passing it on. Learn when it is sent, how it differs from 200, caching rules and what clients should do.
205 Reset Content: What It Does and Browser Support
205 Reset Content tells the client to reset the view that sent the request, like clearing a form. Learn its rules, fetch behaviour and why it is rarely used.
207 Multi-Status: WebDAV Per-Resource Results
207 Multi-Status carries an XML body with a separate status per resource. See a PROPFIND example, how to parse it, and why the top-level code is not the result.