HTTP Request Builder

Compose a well-formed HTTP/1.1 request message from a method, target, headers and body without sending it.

  • Runs locally in your browser
  • No upload required

Try it

Request line
GET /api/items HTTP/1.1
Header lines
1
Body bytes
0
Message
GET /api/items HTTP/1.1 Host: api.example.com
GET /api/items HTTP/1.1
Host: api.example.com

Supported formats

Input
text, select
Output
text

Privacy

Runs entirely in your browser. Your input is never uploaded, stored, or sent to a third party.

Processing
In your browser
Privacy level
Browser only

Built a request message starting with "POST /api/items HTTP/1.1" and 3 header line(s).

How it works

  • Wrote the request line as method, target and HTTP version.
  • Normalized each header line to `Name: value` and added a Host line when one was missing.
  • Added Content-Length: 17 because a body was present and no length or transfer-encoding was supplied.
  • Joined the start line, header block and optional body into one message.
  • The message is text only. This tool never opens a socket and never sends the request.
  • Header order is preserved except for an injected Host line, which is placed first.

Methodology

  1. Upper-case the method and write the request line as method, target and version.
  2. Parse the header block into `Name: value` lines and preserve their order.
  3. Inject a Host line first when the caller did not supply one.
  4. Compute the UTF-8 byte length of the body and inject Content-Length when a body exists and no length or transfer-encoding header was supplied.
  5. Serialize the start line, normalized header block and optional body into the final message.

Usage

  1. Choose the method and the HTTP version.
  2. Enter the request target (a path such as /api/items, or an absolute URL).
  3. Add one header per line as `Name: value`; Host and Content-Length are added when missing.
  4. Optionally add a body, then copy the generated request message.

Examples

These are examples, not current values: they use fixed inputs, while the interactive tool computes live results in your browser.

POST with a JSON body

jsonSelect to copy
{
  "method": "POST",
  "target": "/api/items",
  "version": "HTTP/1.1",
  "headers": "Host: api.example.com\nContent-Type: application/json",
  "body": "{\"name\":\"widget\"}"
}

GET without a body

jsonSelect to copy
{
  "method": "GET",
  "target": "/search?q=hello",
  "version": "HTTP/1.1",
  "headers": "Host: example.com\nAccept: application/json",
  "body": ""
}

Limitations

A message, not a connection

An HTTP message is a request line or status line, a header block, and an optional body. That text form is what HTTP/1.1 puts on the wire. Building it by hand is useful for documentation, teaching and debugging, but it deliberately stops short of the connection: DNS, TLS, framing and connection reuse are all omitted.

Host and Content-Length

Host became mandatory in HTTP/1.1 because one server address can host many names; a request without it is invalid. Content-Length tells the receiver how many body bytes follow. The builder injects both only when they are missing and never overwrites a value you supplied, so an intentional Transfer-Encoding or a fixed length is preserved.

Frequently asked questions

Does this send the request?
No. It builds the exact text a client would send. Nothing leaves the browser, and no server is contacted.
Why was a Host header added?
HTTP/1.1 requires a Host header on every request. If you did not supply one, the tool adds an empty Host line so the message is structurally valid and you can fill it in.
When is Content-Length added?
When you supply a body and no Content-Length or Transfer-Encoding header. The value is the UTF-8 byte length of the body, not the character count.

Sources

  1. RFC 9112 — HTTP/1.1 — IETF
  2. RFC 9110 — HTTP Semantics — IETF
  3. MDN Web Docs — HTTP messages — MDN