HTML: <keygen>
XHTML: <keygen/>  or  <keygen />

HTML5 only. Used as part of a form to generate key pairs that are used in web-based certificate management systems (for secure transactions).

Start/End Tags

This is an empty element. It must be closed with a trailing slash in XHTML5 documents. Developers may include a space character before the slash for backward compatibility with older browsers.


  • HTML5


Values: None in HTML. (autofocus="autofocus" in XHTML5.)
Indicates the control should be active and ready for user input when the document loads.


Values: challenge-string
Provides a challenge string to be submitted with the key.


Values: None in HTML. (disabled="disabled" in XHTML5.)
Prevents the control from being interactive and prevents its value from being submitted.


Values: id of form owner
Associates the element with a named form on the page.


Values: keyword
Identifies the type of key to be generated, for example, rsa or ec.


Values: text
Gives the control an identifying name for the form submission process.

The following is based on an example from, used with permission via a Creative Commons “Attribution-Share Alike” License:

<form method="post" action=" decode.cgi">
  <keygen name="RSA public key" challenge="123456789" keytype="RSA">
  <input type="submit" name="createcertificate" value="Make Key">

Rendered Example