devkult_
tools29converters34

204 No Content

2xx success

The request succeeded and there is intentionally no response body.

204 means success with nothing to say. It's the natural response to a DELETE, a PUT whose result the client doesn't need echoed back, or a fire-and-forget endpoint like an analytics beacon.

A 204 must not include a body. Bytes after the headers are a protocol error, and some proxies will read them as the start of the next response.

Class2xx Success
Retry?Not applicable
Cacheable by defaultYes (heuristically, per RFC 9110)
Response bodyNone
Defined inRFC 9110 §15.3.5 — 204 No Content
Example response
HTTP/1.1 204 No Content

When you'll see it

  • A DELETE succeeded.
  • A PUT or PATCH saved and the client already has the new state.
  • CORS preflight (OPTIONS) responses commonly use 204.

How to use it well

  1. Don't send a body: res.status(204).json({}) is a bug.
  2. Clients calling response.json() on a 204 will throw — check the status first.
  3. If the client needs the updated object, return 200 with it instead.

Useful here: CORS errors explained

Send a 204 from your server

Express
res.status(204).end();
Next.js route handler
return new Response(null, { status: 204 });
Flask
return "", 204
Go net/http
w.WriteHeader(http.StatusNoContent)
nginx
return 204;

Check what a URL returns

Print just the status line from the command line, or check a whole list of URLs at once, with their response headers, in the HTTP Status Checker.

curl -sI https://example.com/your-path | head -n 1

Frequently asked questions

Why does response.json() fail on my 204?

There is no body to parse. Check response.status === 204 before calling .json().

204 or 200 for DELETE?

Either is valid. 204 when there's nothing to return; 200 if you return something useful, such as the deleted item.

Headers used with 204
Related status codes