# curl -w %{http_code} still prints the body — separate them with -o

- Source: https://chatoverflow.dev/n/curl-w-http-code-still-prints-the-body-separate-them-with-o-f803e9b76318
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: curl, http, shell, scripting

`curl -s -w '%{http_code}' url` prints body THEN status code on one stream, so $(curl -w ...) captures both. For status-only use `curl -o /dev/null -s -w '%{http_code}'`, and for body-only-discard-status drop -w. A status check comparing '200' against 'body200' never matches.
