designwithfocus

HTML

HTML Form Action vs Method: What Each Attribute Sends

By Design With Focus Team 6 min read
A small HTML form with the action URL and the method written on the tag

Short answer

The action attribute is the URL that processes the form, and the method attribute is how the browser sends that submission. Method is get, post, or dialog. If you omit method, the HTML Standard's missing value is GET. GET appends fields to the action URL. POST puts them in the body and can change state on the server.

Last verified against the sources listed below.

Key takeaways

  • MDN defines action as the URL that processes the submission, and method as the HTTP method.
  • GET is the default. The HTML Standard's missing and invalid defaults for method are both GET.
  • GET appends the fields to the action URL after a question mark. Use it when there are no side effects.
  • POST sends the body. enctype applies when method is post, and the default is URL-encoded.
  • dialog closes a dialog and does not submit the data. formaction on a button can replace action.
  • IANA lists GET as safe and idempotent, and POST as neither, both pointing at RFC 9110.

HTML form action vs method answers two different questions on the same tag. MDN’s form reference says action is the URL that processes the submission, and method is the HTTP method used to submit. The element itself is a section of interactive controls for sending information. MDN marks the element widely available since July 2015.

If you remember one line, remember the split. Action is where. Method is how. A form with the right URL and the wrong method can still change a database you meant only to search, or put a password in the address bar.

What does each attribute do?

Action names the URL. Method names get, post, or dialog.

The HTML Standard groups action, enctype, method, novalidate, and target as the submission attributes on the form. The matching attributes on a submit button are formaction, formenctype, formmethod, formnovalidate, and formtarget. When the button omits them, the form’s values are used. Action and formaction, if specified, must be a valid non-empty URL, spaces around it allowed.

Method’s keywords are get, post, and dialog. The missing value and the invalid value are both the GET state. Writing method="" or a typo does not invent a new verb.

It submits with GET. The keywords are case insensitive on MDN’s list.

action method
Question it answers Which URL processes the submission Which HTTP method sends it
If you omit it The element’s action can be the empty string GET, the missing-value default
Typical values A path or absolute URL get, post, or dialog
Override on a button formaction formmethod
GET result Fields are appended after ? This column is the method that does that
POST result The URL does not have to carry the fields The body carries them, and the server may change state

HTML is the language of the tag. HTTP is the language of the request the browser builds from it.

Where does action send the data?

Action is the processing URL, and a submit button can point somewhere else.

MDN says the form’s action is ignored when method="dialog". Otherwise the browser submits to that URL, unless a formaction on the button, the submit input, or the image input replaces it. The Standard’s rule for “the action of an element” checks the submit button’s formaction first, then the form owner’s action, then the empty string.

A search form in the Standard uses both attributes on purpose:

<form method="get" action="/search.cgi">
  <label>Search terms: <input type="search" name="q"></label>
  <input type="submit" value="Search">
</form>

The comment in that example says method="get" is the default, written out so the query is submitted in the URL. The action path is /search.cgi. The field name is q. Together they are a GET to that path with the terms in the query string.

An empty action is not a license to guess a host. Follow the Standard’s fallback: button formaction, then the form action, then the empty string. Test the request URL before you ship the form.

Which method should you pick?

Use GET for a lookup with no side effects. Use POST when the submission changes data. Use dialog only to close a dialog.

MDN says GET appends the form data to the action URL with a ? separator, and that you should use it when the form has no side effects. POST sends the data as the request body. enctype is the body type when the method is post.

The default is application/x-www-form-urlencoded. Choose multipart/form-data if the form has a file input. text/plain is there for debugging.

Dialog is not a transport. MDN says that when the form sits inside a dialog, this method closes the dialog and fires a submit event without submitting data or clearing the form. The action is ignored. Do not pick dialog because you want a quieter POST.

IANA’s method registry marks the HTTP verbs the first two map to. GET is safe and idempotent. POST is neither.

A safe method should not change state. An idempotent method can be repeated without a further change. A search fits GET.

Creating an account, charging a card, or saving a password fits POST, because a second identical request is not required to be harmless.

How do GET and POST differ?

GET asks for a representation. POST submits an entity and often changes state.

MDN’s HTTP methods page says GET should only retrieve data and should not contain a request body. POST submits an entity to the resource, often causing a change or other side effects. The same page’s table lists GET as safe, idempotent, and cacheable. POST is not safe, not idempotent, and only conditionally cacheable: the response needs explicit freshness information and a matching Content-Location header.

That is why a GET form can be bookmarked and shared. The fields are in the URL. It is also why a GET form is a bad place for a secret.

The query string lands in history, logs, and the address bar. MDN’s “no side effects” line is the design rule. IANA’s registry, last updated 17 June 2026, points both methods at RFC 9110 and records the same safe and idempotent flags.

POST is the method that can carry a file, because enctype is defined for that method. A GET URL also has practical length limits in browsers and servers. Neither MDN page cited here prints a single maximum length, so this article does not invent one. If the payload is large or binary, POST is the method those pages give you.

What else changes the request?

The button can override the URL and the method, and target only chooses the window.

formaction and formmethod exist so one form can offer two submits, such as “Search” with GET and “Save” with POST, without two separate forms. formnovalidate skips validation for that button when the form would otherwise validate. novalidate on the form skips it for every submit.

target does not pick the server. MDN says _self loads the response in the current context, _blank in a new one, and _parent or _top in an ancestor. A formtarget on the button wins over the form. None of those keywords change action or method.

If the action URL should be something a phone can open, the QR Code Generator can encode that URL. The QR is not the form. The attributes on the form tag are still what the browser submits when someone presses the button.

Frequently asked questions

What does enctype change?

MDN says enctype matters when method is post. It is the MIME type of the body. The default is application/x-www-form-urlencoded. Use multipart/form-data when the form contains a file input. text/plain is listed for debugging. A button, an input of type submit, or an input of type image can override it with formenctype. On a GET form the fields ride in the URL, so this MIME type is not the carrier.

Can a button replace the form action?

Yes. MDN says a formaction attribute on a submit button, an image input, or a submit input overrides the form action. The HTML Standard says the action used is the button's formaction when the submit control has one, otherwise the form owner's action, otherwise the empty string. formmethod overrides method the same way. One form can therefore post to two URLs if two submit buttons carry different formaction values.

What does method dialog do?

MDN says dialog is allowed only as a method value, and that when the form is inside a dialog element, submission closes the dialog and fires a submit event without submitting data or clearing the form. The action attribute is ignored when method is dialog. The HTML Standard's short description matches: the form is meant to close its dialog, if any, and otherwise not submit. It is not a third way to POST.

Are GET and POST safe to repeat?

IANA's method registry, updated 17 June 2026, marks GET as safe and idempotent and POST as not safe and not idempotent. Both rows cite RFC 9110. MDN matches that table and adds that GET is cacheable, while POST is cacheable only when the response includes freshness information and a matching Content-Location header. A search form can use GET. A payment or a password change should not.

What is the target attribute for?

MDN says target chooses where to show the response after submit. _self, the default, uses the current browsing context. _blank opens a new one. _parent and _top walk up the frame tree. A formtarget on the submit control can override it. Target does not change the action URL or the method. It only chooses the browsing context that loads the response.

Sources