204 vs 205: No Content vs Reset Content

Both codes are success responses with no body, but they differ in what they ask the client to do with its UI after the request.

AspectHTTP 204 — No ContentHTTP 205 — Reset Content
RFCRFC 9110, Section 15.3.5RFC 9110, Section 15.3.6
Has bodyNo — MUST NOT include a bodyNo — MUST NOT include a body
Client actionDo nothing — stay where you areReset the UI element that triggered the request
Browser behavior on form submitStay on current page, no changeStay on current page, clear the form fields
AJAX behaviorPromise resolves with empty responsePromise resolves; developer must call form.reset()
CacheableYes (default)No
Common useDELETE, autosave, OPTIONS preflightReusable data-entry forms, comment submission, chat input

204: Success, Nothing to Do

204 No Content says: “the operation succeeded and you do not need to do anything with the result.” The page stays as-is. No navigation, no form clearing, no UI changes required. It is the appropriate response when the operation has no side effect on the current user interface — background saves, delete confirmations, heartbeat pings.

// Autosave handler: just confirm success
app.patch('/api/drafts/:id', async (req, res) => {
  await Draft.update(req.params.id, req.body);
  res.sendStatus(204);
});

205: Success, Reset the Form

205 Reset Content says: “the operation succeeded and the client should reset the initiating UI element to its initial state.” For a standard HTML form submission, this means the browser clears all form fields automatically. For an AJAX submission, the developer must call form.reset() explicitly when receiving 205.

// Comment form: clear after successful submission
app.post('/api/comments', async (req, res) => {
  await Comment.create(req.body);
  res.sendStatus(205); // signal: clear the comment form
});

// AJAX client handling 205
const res = await fetch('/api/comments', { method: 'POST', body: formData });
if (res.status === 205) {
  commentForm.reset();
  showToast('Comment posted!');
}

205 is semantically precise: it communicates that the form should be ready for another submission immediately. Without it, the client has to make its own decision about whether to clear the form — which often ends in inconsistent behavior across different pages or scenarios.

Decision Rule

Use 204 for background operations where the UI does not need to change: DELETE, silent autosave, CORS preflight, heartbeats.

Use 205 for foreground form submissions where the form should be ready for immediate reuse: comment boxes, search bars, data-entry forms, chat input.

In practice, many teams use 200 with a JSON confirmation body for both cases and handle UI logic entirely in JavaScript. 204 and 205 are semantically richer but require client-side awareness of the status codes.

FAQ

Do browsers actually reset forms on 205?

Yes, for standard HTML form submissions (not AJAX). Chrome and Firefox both implement the HTML spec behavior of resetting forms on 205. For AJAX/fetch calls, no automatic reset occurs — the JavaScript code must call form.reset() explicitly.

Can I use 205 for a DELETE operation?

Technically yes if a form triggered the deletion and you want the form to reset. In most applications, deletion does not involve a form that needs resetting, so 204 is more appropriate. The choice depends on the specific UI context.

Why is 204 cacheable but 205 is not?

RFC 9110 makes 204 cacheable by default, likely because empty responses from GETs can be cached. 205 is not cacheable because it signals a dynamic UI state that should not be replayed. In practice, both should use Cache-Control: no-store when returned from write operations.

Full Guides

HTTP 204 No Content — full guide · HTTP 205 Reset Content — full guide · All comparisons

Related comparisons