What 204 means
The server successfully handled the request and has nothing to send back. 204 is defined in RFC 9110 §15.3.5. The response ends after the headers: a 204 cannot contain a body, and a server must not send Content-Length with it (§8.6).
HTTP/1.1 204 No Content
Date: Mon, 05 Oct 2026 09:00:00 GMT
ETag: "v7"
Headers still matter. An ETag in a 204 after a PUT, for example, tells the client the new version of the resource it just saved. 204 is cacheable by default, although in practice it's rarely sent to cacheable GET requests.
When to send it
- PUT or PATCH that saved the change, when the client already has the data and doesn't need it echoed back.
- DELETE that removed the resource.
- Autosave, analytics beacons and pings (
navigator.sendBeacon), where nobody reads the response. - CORS preflight (
OPTIONS) responses, which carry onlyAccess-Control-Allow-*headers.
When a user navigates to a URL or submits a form and gets a 204, the browser stays on the current page and doesn't change what's displayed. That's occasionally useful, but usually means the user sees nothing happen.
Common problems
response.json()throws in the browser ("Unexpected end of JSON input") because there's no body to parse. Checkresponse.status === 204(orresponse.okplus an empty body) before parsing.- A body sent anyway. Some frameworks or middleware write
{}ornullafter a 204. Clients ignore it at best; on a keep-alive connection, stray bytes can be read as the start of the next response. - 204 where the client needs data, such as the server-generated ID or timestamps after a create. Return 200 or 201 Created with the resource instead.
- 204 on a page URL. A GET to an HTML page that answers 204 shows nothing, and there's nothing to index.
How to send it
Express: res.status(204).end() or res.sendStatus(204) (Express removes any body you pass with 204). nginx, for a beacon endpoint:
location = /ping {
access_log /var/log/nginx/ping.log;
return 204;
}
204 and SEO
Google documents that for a 204, Googlebot tells the indexing pipeline it received no content, and Search Console may report the URL as a soft 404 in the Page indexing report. A page you want indexed must answer 200 with its content. For API and beacon endpoints this doesn't matter; keep them out of your sitemap and, if they get crawled, out of search with X-Robots-Tag: noindex or robots.txt.
Related codes
- 200 OK: success with a body.
- 201 Created: a new resource was created; include its
Location. - 304 Not Modified: also bodiless, but means "your cached copy is still good".
- 205 Reset Content: success, and the client should reset the form that sent the request.
Check what an endpoint returns, and whether it sneaks a body into a 204, with the HTTP Request Builder.