HTML <keygen> tag

HTML <keygen> tag : Definition


• The <keygen> element is used to generate an encryption key for passing encrypted data to a server.

• When an HTML form is filled and submitted, the browser generally generates a key pair and stores its private key into browser's local key storage and sends the public key to the server.

• This element is can only be written in inline.

Html <keygen> tag example

<!DOCTYPE html>
<html>
<body>

<form action="#" method="get">
  Username: <input type="text" name="usr_name">
  Encryption: <keygen name="keygen">
  <input type="submit">
</form>



<p><strong>Note:</strong> The keygen tag is not supported in Internet Explorer.</p>

</body>
</html>

Output:

Username: Encryption:

Note: The keygen tag is not supported in Internet Explorer.