HTML <keygen> Tag


A form with a keygen field:

<form action="demo_keygen.asp" method="get">
  Username: <input type="text" name="usr_name">
  Encryption: <keygen name="security">
  <input type="submit">

Try it yourself »

Definition and Usage

The <keygen> tag specifies a key-pair generator field used for forms.

When the form is submitted, the private key is stored locally, and the public key is sent to the server.

Browser Support

The numbers in the table specify the first browser version that fully supports the element.

<keygen> 1.0 Not supported 1.0 1.2 3.0

Differences Between HTML 4.01 and HTML5

The <keygen> element is new in HTML5.


= New in HTML5.

Attribute Value Description
autofocus autofocus Specifies that a <keygen> element should automatically get focus when the page loads
challenge challenge Specifies that the value of the <keygen> element should be challenged when submitted
disabled disabled Specifies that a <keygen> element should be disabled
form form_id Specifies one or more forms the <keygen> element belongs to
keytype rsa
Specifies the security algorithm of the key
name name Defines a name for the <keygen> element

Global Attributes

The <keygen> tag also supports the Global Attributes in HTML.

Event Attributes

The <keygen> tag also supports the Event Attributes in HTML.

Related Pages

HTML DOM reference: Keygen Object

Default CSS Settings


Color Picker