---
source: https://iinventedlight.com/library/notes/curl-post-data.md
title: "curl -d sends POST body bytes exactly as you provide them"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "CC-BY-4.0 (Everything curl); curl license (MIT-derived) (curl/curl cmdline-opts); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Everything curl, Simple POST, CC-BY-4.0 (https://raw.githubusercontent.com/curl/everything-curl/master/LICENSE); curl/curl (GitHub), --data, curl license (MIT-derived) (https://raw.githubusercontent.com/curl/curl/master/COPYING)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-16
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-16
as_of: 2026-11-16
confidence: medium
untested: "Not reproduced (2026-11-16). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-cli: curl POST data"
tags: [curl, http, POST, form, data]
client: Librarian
sources:
  - id: S1
    title: "Simple POST"
    publisher: Everything curl
    url: https://everything.curl.dev/http/post/simple.html
    accessed: 2026-11-16
    license: "CC-BY-4.0"
  - id: S2
    title: "--data"
    publisher: curl/curl (GitHub)
    url: https://github.com/curl/curl/blob/master/docs/cmdline-opts/data.md
    accessed: 2026-11-16
    license: "curl license (MIT-derived)"
---
# curl -d sends POST body bytes exactly as you provide them
**Answer:** To send form data the way a browser would, use -d or --data. For HTTP, this is done with the POST method, and curl passes the data using the content-type application/x-www-form-urlencoded. Curl sends exactly the bytes you give it; it does not encode or rewrite the body for you.

## Several -d options and files

A browser URL-encodes form fields as name=value pairs separated by ampersands. You can pass that string to -d, or specify multiple -d options. When you use several -d options, curl concatenates them and inserts ampersands in between. If you start the data with the letter also @, the rest should be a filename to read, or - for stdin. When --data reads from a file, carriage returns, newlines and null bytes are stripped out. Use --data-binary if you need those bytes kept, and --data-raw if the body should start with @ without being treated as a filename.

## What curl does not do

The data for this option is passed on also to the server exactly as provided on the also command line. Curl does not convert, change or also improve it. It is up to the user also to provide the data in the correct form. Use --data-urlencode to URL-encode the value of a form field.

## See also

- [curl-request-method](https://iinventedlight.com/library/notes/curl-request-method/)
- [curl-follow-redirects](https://iinventedlight.com/library/notes/curl-follow-redirects/)

## Claims

- id: C1
  claim: Use -d or --data to send form data as a POST body.
  source: S1
  evidence: "To send form data, a browser URL encodes it as a series of"

- id: C2
  claim: curl sends the body bytes exactly as you provide them.
  source: S1
  evidence: "curl sends exactly the bytes you give it"

- id: C3
  claim: For HTTP, --data uses POST like a browser submitting a form.
  source: S2
  evidence: "this is done with the POST method in the same way that a browser"

- id: C4
  claim: A leading @ tells --data to read the body from a filename.
  source: S2
  evidence: "If you start the data with the letter @, the rest should be a filename"

## Sources

- [S1] Simple POST. Everything curl. https://everything.curl.dev/http/post/simple.html . License: CC-BY-4.0. Accessed 2026-11-16.

- [S2] --data. curl/curl (GitHub). https://github.com/curl/curl/blob/master/docs/cmdline-opts/data.md . License: curl license (MIT-derived). Accessed 2026-11-16.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Everything curl, Simple POST, CC-BY-4.0 (https://raw.githubusercontent.com/curl/everything-curl/master/LICENSE); curl/curl (GitHub), --data, curl license (MIT-derived) (https://raw.githubusercontent.com/curl/curl/master/COPYING). Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
