The <form> tag is used to create an HTML form for user input.

A form can contain input elements like text fields, checkboxes, radio-buttons, submit buttons and more. A form can also contain select menus, textarea, fieldset, legend, and label elements.

Example Code:
<form action="" method="post">
  First name: <input type="text" name="first_name" /><br />
  Last name: <input type="text" name="last_name" /><br />
  <input type="submit" value="Submit" />
First name:
Last name:
Attribute Definition
accept-charset Specifies a list of character encodings that the server accepts.
action Specifies a URI/URL of the page that will process the form.
autocomplete Specifies whether a form should have autocomplete on or off
enctype Specifies the content type used to encode the form data set when it's submitted to the server.
Possible values:
  • application/x-www-form-urlencoded (default)
  • multipart/form-data (use this when uploading files)
method Specifies the HTTP method to use when the form is submitted.
Possible values:
  • get (the form data is appended to the URL when submitted)
  • post (the form data is not appended to the URL)
name Assigns a name to the form. This is used when referencing the form with stylesheets or scripts. If there are multiple forms, the name of each form must be unique.
novalidate Specifies that the form should not be validated when submitted

Specifies where to open the action URL.
Possible Values:

  • _blank
  • _parent
  • _self
  • _top
Global Attributes:

The <form> tag also supports the Global Attributes in HTML5

Event Attributes:

The <form> tag also supports the Event Attributes in HTML5

Last updated on 2 August 2018 By Rene Spronk

View All HTML Tags

Errors? Please help to keep this list up to date, If you find any errors, please contact us, so that we can get them fixed.