The <keygen> element was a form control that generated a public/private key pair in the browser. On submit, the public key was sent to the server; the private key stayed on the device (often for certificate enrollment).
Study it for legacy pages only. There is no modern HTML replacement element — certificate workflows use platform tools or the Web Cryptography API, not <keygen>.
Obsolete.
Non-conforming in the HTML Living Standard. Removed from browsers (e.g. Chrome ~57). Do not use it in new forms.
Use instead.
For enrollment: generate keys with the Web Cryptography API, then export/install materials for the user. For enterprise device management: use native on-device management — not an HTML tag. Ordinary forms still use <form> and <input>.
Syntax
HTML Syntax
syntax.html
<keygen name="pubkey">
Historically a void element (no end tag, no children), used inside a <form>. Modern browsers ignore it as a key-pair control.
Reference
Attributes
Historical attributes on <keygen> (all obsolete with the element):
<keygen> does not generate keys here. This preview shows what a modern page should do instead: a normal form without keygen, plus a clear obsolete notice.
Simulated legacy markup note — no key pair is created in the browser.
Modern form (no keygen)
Legacy would have been: <keygen name="pubkey"> — ignored today.
Demo only — form does not upload or generate keys.
Code
HTML Examples
Legacy snippets are for study. Prefer forms without <keygen> for real pages.
Example 1 — Basic keygen in a Form
Historical minimum: a named keygen control inside a form. Modern browsers do not generate keys.
HTML
<!-- Obsolete — do not use -->
<form action="/enroll" method="post">
<label for="user">Username:</label>
<input type="text" id="user" name="user">
<keygen name="pubkey">
<button type="submit">Enroll</button>
</form>
Collect normal fields with labeled <input> controls.
Optionally accept a file if your flow imports a certificate the user already has.
Generate keys elsewhere (Web Crypto / OS / MDM) — not with an HTML tag.
Edge Cases & Pitfalls
Most problems with <keygen> today are assuming it still enrolls certificates.
obsolete
Never ship in new HTML
Validators flag it. Replace enrollment with Web Crypto or platform certificate tools.
security
Inconsistent and removed
Browser support was uneven; Chrome emptied then removed the control. Do not rebuild on it.
html
No HTML successor tag
Unlike isindex → form+input, keygen has no drop-in HTML element. Use APIs/tools instead.
forms
Leaving keygen in a form is useless
It will not submit a public key in modern browsers. Audit old enrollment pages and remove the tag.
attrs
challenge / keytype died with the element
Those attributes are not general HTML form attributes — they only made sense on keygen.
Compatibility
Browser Support
The <keygen> element is obsolete. It is non-conforming for authors in the HTML Living Standard. Chrome removed it around version 57; other modern engines do not provide a useful keygen UI.
✓ Obsolete · Not supported
<keygen>
No useful key-pair form control in modern Chrome, Firefox, Safari, Edge, or Opera.
0%Modern keygen support
Google ChromeRemoved (~57+)
Not supported
Mozilla FirefoxNo useful UI
Not supported
Apple SafariNo useful UI
Not supported
Microsoft EdgeNo useful UI
Not supported
OperaRemoved with Chromium
Not supported
Internet ExplorerNever / EOL
Not supported
<keygen>Not supported
Bottom line: Learn <keygen> for history and audits only. Build enrollment with Web Crypto or platform certificate tooling — not HTML keygen.
Remember
Key Takeaways
Role:<keygen> once generated key pairs inside HTML forms.
Attrs: legacy name, challenge, keytype (plus form control attrs).
Status: obsolete — do not use in new documents.
Replace with: Web Crypto / OS certificate tools — not another HTML tag.
One line:<keygen> is web history — learn it to remove it, not to build new enrollment.
UA style
Default CSS Settings
Modern browsers do not expose a meaningful keygen control. There is no reliable user-agent stylesheet to depend on:
default.css
/* Conceptual only — do not rely on keygen styling */
keygen {
display: none;
}
Style ordinary <form> / <input> controls instead.
Frequently Asked Questions
keygen was a form control that generated a public/private key pair in the browser. On submit, the public key (and challenge) were sent to the server while the private key stayed local — mainly for certificate enrollment.
No. It is obsolete and non-conforming for authors. The WHATWG HTML Standard tells authors not to use it.
For certificate enrollment, use the Web Cryptography API to generate a key pair, then export materials for the user to install. For enterprise device management, use native on-device management — not an HTML tag.
challenge was a string submitted with the public key. keytype selected the key algorithm (historically rsa). Both are obsolete with the element.
No. Chrome removed it (around Chrome 57). Current Firefox, Safari, and Edge do not provide a useful keygen control. Do not depend on it.
No. Learn it only to recognize legacy markup. Never add it to new forms.