splitforms.com

HTML · FORM ATTRIBUTE

HTML Form Method — GET vs POST explained (live demo)

The method attribute decides how a form sends its data. GET appends it to the action URL as a query string (for searches and filters); POST puts it in the request body (for contact, registration, and anything sensitive or large). Use POST for real submissions. Paste any body into the URL encoder and decoder to see exactly how a form is encoded.

  • Live, editable example
  • Copy-paste snippet
  • Attributes & common mistakes
Live demo · nothing is sent

What gets submitted

Fill in the form above and press its button. The demo stops the request and lists every name=value pair the browser would send, plus the controls it leaves out.

With a free access key in the form, these fields land in your splitforms dashboard; access_key and botcheck are read by splitforms, not stored as lead data.

Edit the HTML and re-run it
Runs in a sandbox. Nothing is sent.

Minimal snippet

form-method-example.html
<!-- GET: data goes in the URL, for searches -->
<form action="/search" method="get">
  <input type="search" name="q">
</form>

<!-- POST: data goes in the request body, for real forms -->
<form action="/contact" method="post">
  <input type="email" name="email">
</form>

Want this form to email you its submissions? Point it at a free splitforms endpoint, with no server to build. Get a free access key →

Copy-paste code

HTML Form Method (GET vs POST) code you can paste today.

Replace YOUR_ACCESS_KEY with a key from your free splitforms dashboard. The form posts to one endpoint — submissions land in your inbox and dashboard with spam filtering built in.

form-method.html
<form action="https://splitforms.com/api/submit" method="POST">
  <input type="hidden" name="access_key" value="YOUR_ACCESS_KEY">

  <label for="name">Name</label>
  <input type="text" id="name" name="name" required>

  <label for="email">Email</label>
  <input type="email" id="email" name="email" required>

  <!-- Honeypot: hidden from people, bots fill it in -->
  <input type="checkbox" name="botcheck" style="display:none" tabindex="-1" autocomplete="off">

  <button type="submit">Send</button>
</form>

GET vs POST

What is the difference between GET and POST in a form?

GET adds the fields to the URL as a query string; POST sends them in the request body. That one difference decides everything else: GET results can be bookmarked and shared, while POST keeps data out of the address bar and is the only method that can upload files.

What is the difference between GET and POST in a form?
Questionmethod="get"method="post"
Where the data goesThe URL: /search?q=shoes&size=9The request body
Visible inThe address bar, history, bookmarks, server logs and analyticsDeveloper tools only, and the server that receives it
Refresh and BackRepeats the request quietlyThe browser asks before sending the data again
Bookmark or share the resultYesNo
File uploadsNo, only the filename is sentYes, with enctype="multipart/form-data"
SizeServers commonly reject request lines over about 8 KB (Apache's default limit is 8,190 bytes)Set by the server, for example nginx's default 1 MB body limit
Use forSearch boxes, filters, sorting, paginationContact, sign-up, login, checkout, anything that changes data
DefaultYes, when method is missing or invalidMust be set explicitly

Neither method encrypts anything. HTTPS encrypts the URL path, query string and body alike; GET's risk is that the URL is stored and shown in more places.

Sources: WHATWG HTML Standard: form submission algorithm · MDN: Sending form data

Attributes · <form method>

Which HTML Form Method (GET vs POST) attributes matter?

These attributes decide how the <form method> behaves and what actually gets emailed to your inbox when someone submits.

HTML Form Method (GET vs POST) attributes and what each one does
AttributeWhat it does
getThe default. Appends the fields to the action URL as ?name=value&…, replacing any query string the action already had. Visible in the address bar, history and server logs, so use it for searches and read-only filters.
postSends fields in the request body, not the URL. Use for contact, login, payment, and any large or sensitive data.
dialogCloses the <dialog> the form is inside and sets the dialog's returnValue to the clicked button's value. Nothing is sent to a server.
put, delete, patchNot supported. Any value other than get, post or dialog falls back to GET, so method="delete" sends a GET request. Send these methods with fetch instead.
formmethod (button)Overrides the form's method for one button, e.g. a 'Delete' button that POSTs to a different handler.

Common mistakes

HTML Form Method (GET vs POST) not working? Here's why.

Most broken forms come down to a few small mistakes with the <form method>. Check these before you ship, then forward every submission to Slack or a webhook.

  1. GET leaks data into URLs

    GET puts every field in the URL, so emails and messages land in browser history, server logs, analytics tools and same-site Referer headers. Never use GET for personal data, passwords or messages.

  2. Long GET requests get rejected

    Many servers refuse a request line over about 8 KB and answer 414 URI Too Long. A long message can hit that, and a file input sends only its filename. POST bodies have a limit too, but it is set by the server and is usually far larger.

  3. method="put" quietly becomes GET

    HTML forms only send GET and POST. An unknown method falls back to GET, so a form meant to delete or update data puts its fields in the URL instead. Use POST, or fetch with the method you need.

  4. Refreshing a POST result submits again

    After a POST, Refresh and Back ask to resend the data, and a Yes creates a duplicate. Answer a successful POST with a redirect to a thank-you page (Post/Redirect/Get), as a form backend does.

  5. POST still needs CSRF care

    POST keeps data out of the URL but doesn't make it safe on its own. For your own server, add CSRF protection to any form that changes data for a logged-in user.

Sources: WHATWG HTML Standard: <form method> · MDN: <form method>

method="get"

What URL does a GET form create?

The browser takes the action URL, drops any query string it had, and adds each named field as name=value, joined with & and URL-encoded. Spaces become +. That makes GET right for search and filters: the result page has a URL people can bookmark and share.

get-search-form.html
<form action="/products" method="get">
  <input type="search" name="q" value="running shoes">
  <select name="size">
    <option>9</option>
    <option selected>10</option>
  </select>
  <button type="submit">Search</button>
</form>

<!-- Submits to: /products?q=running+shoes&size=10 -->

fetch

How do I send PUT or DELETE from an HTML form?

A form can't: method only accepts get, post and dialog. Listen for the form's submit event and send the request with fetch, which accepts any method. Server frameworks that need plain HTML forms often read a hidden _method field on a POST instead.

form-put.html
<form id="profile" action="/api/profile" method="post">
  <input type="text" name="name" required>
  <button type="submit">Save</button>
</form>

<script>
  const form = document.getElementById("profile");
  form.addEventListener("submit", async (event) => {
    event.preventDefault();
    const body = JSON.stringify(Object.fromEntries(new FormData(form)));
    await fetch(form.action, {
      method: "PUT",
      headers: { "Content-Type": "application/json" },
      body,
    });
  });
</script>

Key benefits

Copy-paste ready

The HTML Form Method (GET vs POST) example below is a complete, working form — paste it into any HTML page and it submits, no edits to the markup required.

No backend to build

Your html form method (get vs post) form posts to one endpoint. No server, PHP, or API route — accepted submissions are saved to your dashboard before owner notification email is attempted; delivery time and inbox placement depend on provider and recipient settings.

A form that really submits

Unlike a static reference snippet, this <form method> form actually sends data to a free splitforms backend, with spam filtering built in.

How it works

How to add HTML Form Method (GET vs POST) to any page.

Copy the html form method (get vs post) example, drop in your free access key, and paste it into any page — submissions start landing in your dashboard.

  1. Copy the code

    Copy the HTML Form Method (GET vs POST) example below.

  2. Add your access key

    Replace YOUR_ACCESS_KEY with a free splitforms key from the dashboard.

  3. Paste into your site

    Drop the form into any HTML page. Submissions arrive in your dashboard.

Questions

HTML Form Method (GET vs POST) questions, answered.

Anything missing? Email us, we read every message.

A person reading answers to common questions
What is the difference between GET and POST in HTML forms?

GET appends the form data to the action URL as a query string and is meant for searches and read-only requests. POST sends the data in the request body and is the correct method for contact, login, and registration forms because it keeps large or sensitive data out of the URL.

When should I use method="post"?

Use method="post" for anything that sends real user data — contact forms, sign-ups, logins, payments, and file uploads. It keeps the data out of the URL and has no practical size limit.

What does method="get" do?

It appends each field as ?name=value to the action URL. The data becomes visible in the address bar and browser history, so it should only be used for safe, read-only requests like a search box.

Which method is used for file uploads?

POST only. Files travel in the request body as multipart/form-data; GET cannot send file contents at all.

What is the default form method?

The default is GET. Because that exposes submitted data in the URL, you should explicitly set method="post" on any form that collects real information.

Can an HTML form use PUT or DELETE?

No. The method attribute accepts only get, post and dialog, and any other value falls back to GET. Send PUT, PATCH or DELETE with fetch from a submit handler, or use POST with a hidden _method field if your server framework supports it.

Show 2 more questions
Is POST more secure than GET?

Only in where the data ends up. POST keeps it out of the URL, history and server logs, but it is not encrypted. HTTPS encrypts GET and POST requests equally, so use HTTPS for every form and POST for anything personal.

Is the method attribute case-sensitive?

No. method="POST", method="post" and method="Post" all mean POST. Lowercase is the common style.

View all FAQs

Make this form actually submit.

Point your form at splitforms. 500 free submissions a month, spam filtering, webhooks on paid plans — no server.

  • No credit card required
  • 500 free submissions
  • Setup in minutes
Two people celebrating a working contact form