HTTP 204 No Content

Quick answer

HTTP 204 No Content means the request succeeded but there is no response body to return. It is common for DELETE and successful PUT requests.

What HTTP 204 means

204 No Content signals success with deliberately no body. The client should not try to parse a response body, because there is none. It is the idiomatic response for a DELETE that succeeded, or a PUT/PATCH that updated a resource when the API does not return the updated entity.

Common causes

Response body

A 204 response has no body by definition — there is no JSON to return. Clients should check the status code and skip body parsing.

Raw HTTP response

HTTP/1.1 204 No Content
Date: Tue, 02 Jun 2026 10:00:00 GMT

How to handle HTTP 204

The most common 204 bug: calling res.json()

The number-one client mistake with 204 is calling response.json() on it. Because the body is empty, JSON.parse throws "Unexpected end of JSON input". Guard on the status before reading the body:

const res = await fetch(`/api/users/${id}`, { method: 'DELETE' });

if (res.status === 204) {
  return null;            // success, nothing to parse
}
if (!res.ok) throw new Error(`Delete failed: ${res.status}`);
return res.json();        // only reached for 200-with-body responses

This is the same class of error covered in fixing "Unexpected end of JSON input" — an empty body and a blind .json() call.

204 vs 200 with an empty body

These are subtly different. 204 tells the client there is deliberately no body, so a well-behaved client won't even try to read one. 200 with an empty body (or 200 returning {} / []) says "success, and here is the content" — which then is parseable. For a DELETE with nothing to say, 204 is the cleaner, more explicit choice; for "success with an empty collection," return 200 with [] rather than 204.

Frequently Asked Questions

Can a 204 response have a body?

No. 204 No Content explicitly means there is no message body. A client that tries to parse a body on a 204 may throw an "unexpected end of JSON input" error. If you need to return data, use 200 OK.

When should an API return 204 instead of 200?

Return 204 when the operation succeeded but there is genuinely nothing to send back — most commonly a DELETE, or an update where you do not return the updated resource.

Why does my fetch fail to parse JSON on a 204?

Because there is no body to parse. Check for status 204 before calling response.json(), or your client will error on the empty body.

Should a successful DELETE return 204 or 200?

Both are valid. Return 204 No Content if there is nothing meaningful to send back — the cleanest, most common choice for DELETE. Return 200 OK with a body if you want to confirm what was deleted or return a status message.

Does a 204 need a Content-Type header?

No. Since there is no body, a Content-Type header is unnecessary and should be omitted. Sending Content-Length: 0 (or no Content-Length) is correct; do not advertise a JSON body that isn't there.

Working with a JSON API response?

Format and inspect any response in your browser — nothing is uploaded.

JSON Formatter JSON Validator All HTTP Status Codes
About the author

Pasindu Ishan is a software developer based in Sri Lanka. He builds privacy-first developer tools at JSON Dev Tools.