HTML Form Action — What It Does and How to Use It
The `action` attribute on a `<form>` tells the browser where to send the form data when the user submits. Complete reference plus the common gotchas (absolute vs relative URLs, the formaction override, mailto: action, POST vs GET).
The `action` attribute on a `<form>` element is the URL the browser POSTs to when the form is submitted. It can be an absolute URL (`https://splitforms.com/api/submit`), a relative URL (`/api/contact`), or — historically — a `mailto:` URL. If `action` is omitted, the form posts to the current page URL.
Per the HTML specification (WHATWG §4.10.21.1), the `action` attribute determines the 'form submission URL' for the form. The browser appends form fields to that URL (as query string for GET, as request body for POST) and navigates to it. The user-facing behavior is the standard form-submit page transition: the new URL loads, often with the server returning a redirect to a thank-you page.
The `formaction` attribute (HTML5) lets individual submit buttons override the form's action. Useful for forms with multiple actions — Save Draft vs Publish, for example, can POST to different endpoints from the same form HTML. The button's `formaction` wins over the form's `action` when that specific button is the one that triggered submission.
Common gotchas: (1) `mailto:` actions are broken on most modern devices — the visitor needs a configured email client, which most don't have. Use a form-backend service instead. (2) Cross-origin POSTs require the destination to send permissive CORS headers; splitforms's endpoint does. (3) If you set the action to a 404 URL, the browser still POSTs and shows the 404 page — debug by testing with `curl -X POST` first.
How to set this up
Pick an absolute URL
For forms posting to an external backend service, use the full URL: https://splitforms.com/api/submit.
Or a relative URL
For internal endpoints in your app: /api/contact. Same-origin POST, no CORS concerns.
Set method=POST
Always POST for forms that change state or send sensitive data. GET only for search forms with bookmarkable URLs.
(Optional) Add formaction overrides
If you have multiple submit buttons that post to different endpoints, set formaction per button.
Action URL, method POST, splitforms backend — three attributes, working form.
Frequently asked questions
What does the action attribute in HTML form do?
The action attribute specifies the URL the form data will be sent to when the form is submitted. It's the destination of the POST (or GET) request the browser makes when the user clicks the submit button.
What happens if I don't set the action attribute?
If action is omitted, the form submits to the current page URL. That's rarely what you want — set action explicitly to the URL of your backend handler.
Can I use a mailto: action?
Technically yes, but it's broken in practice. mailto: actions open the visitor's default email client to send the form data — but most users don't have a configured client, and the user experience is bad even when they do. Use a form-backend service instead: action="https://splitforms.com/api/submit".
What's the difference between action and formaction?
action is on the <form> element and applies to all submit buttons. formaction is on a specific <button type="submit"> and overrides the form's action when that button is clicked. Use formaction for forms with multiple submit destinations (e.g., Save Draft + Publish).
Should I use action or fetch() for form submission?
Either works. Native action attribute uses the browser's built-in form submission — page reloads, server returns the next page or a redirect. fetch() lets you submit via JavaScript with inline DOM updates and no page reload. Use action for progressive-enhancement baseline; layer fetch on top if you want the no-reload UX.
Related guides
Ship the form, not the backend.
Free for 1,000 submissions/month. Email delivery, AI spam filtering, signed webhooks, real dashboard — all on the free plan. No credit card.
Get a free access key →