ECC Key Generator Online | ECDSA P-256, P-384, P-521, secp256k1
Key Exchange How It Works
What Is ECC Key Generation?
ECC (Elliptic Curve Cryptography) is a modern public-key cryptography approach that provides equivalent security to RSA with much smaller keys. An ECC private key is a random scalar number; the public key is the corresponding point on the elliptic curve. The mathematical relationship between them enables digital signatures (ECDSA) and key agreement (ECDH).
This tool generates, signs, verifies, and analyzes elliptic-curve key pairs entirely in your browser. Supports P-256, P-384, P-521, and secp256k1 curves with export to PEM, JWK, or hex format. The three NIST curves use the browser's native crypto.subtle API; secp256k1 runs through the audited @noble/curves library. No key material ever leaves the page.
When to Use ECC Keys
- TLS certificates — ECC (P-256) is the default for modern TLS 1.3 certificates
- JWT signing (ES256/ES384/ES512) — Smaller, faster signatures for web tokens
- SSH authentication — Ed25519 and ECDSA are the modern SSH key types
- Blockchain / cryptocurrency — secp256k1 is the standard curve for Bitcoin and Ethereum
- Key agreement (ECDH) — Establish shared secrets with smaller keys than RSA DH
- When NOT to use — For maximum legacy compatibility, RSA is still more widely supported
Curve Comparison
| Curve | Key Size | Security Level | RSA Equivalent | Best for |
|---|---|---|---|---|
| P-256 | 256-bit | 128-bit | ~3072-bit | TLS, JWT ES256, general-purpose |
| P-384 | 384-bit | 192-bit | ~7680-bit | Government, payment, JWT ES384 |
| P-521 | 521-bit | 256-bit | ~15360-bit | Maximum security, JWT ES512 |
| secp256k1 | 256-bit | 128-bit | ~3072-bit | Bitcoin, Ethereum, blockchain |
Standards Compliance
- NIST FIPS 186-5 — Digital Signature Standard (DSS) — ECDSA specifications
- SEC 1 / SEC 2 — Standards for Efficient Cryptography (curve definitions)
- RFC 6090 — Fundamental Elliptic and Elliptic Curve Cryptography
- RFC 8446 (TLS 1.3) — ECC key exchange for modern TLS
- Web Crypto API — W3C standard for browser-based ECC operations
Last updated:
Code Examples
Generate ECC key pairs in multiple languages:
JavaScript — Web Crypto API (Browser)
// P-256 ECDSA key pair generation
const keyPair = await crypto.subtle.generateKey(
{ name: 'ECDSA', namedCurve: 'P-256' },
true, // extractable
['sign', 'verify']
);
// Export public key as SPKI PEM
const pubBuf = await crypto.subtle.exportKey('spki', keyPair.publicKey);
const pubPem = '-----BEGIN PUBLIC KEY-----
' +
btoa(String.fromCharCode(...new Uint8Array(pubBuf)))
.match(/.{1,64}/g).join('
') +
'
-----END PUBLIC KEY-----';
console.log(pubPem); Python — PyCryptodome
from Crypto.PublicKey import ECC
# Generate P-256 ECDSA key pair
key = ECC.generate(curve='P-256')
with open('private.pem', 'wb') as f:
f.write(key.export_key('PEM'))
with open('public.pem', 'wb') as f:
f.write(key.public_key().export_key('PEM')) Go — crypto/ecdsa
import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
)
privateKey, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
publicKey := &privateKey.PublicKey
// Export using x509.MarshalECPrivateKey / x509.MarshalPKIXPublicKey Rust — p256 crate
use p256::ecdsa::{SigningKey, VerifyingKey};
use p256::ecdsa::signature::Signer;
let signing_key = SigningKey::random(&mut rng);
let verifying_key = VerifyingKey::from(&signing_key);
// Sign a message
let signature: ecdsa::Signature = signing_key.sign(b"message"); Node.js — crypto module
const { generateKeyPairSync } = require('crypto');
const { publicKey, privateKey } = generateKeyPairSync('ec', {
namedCurve: 'P-256',
publicKeyEncoding: { type: 'spki', format: 'pem' },
privateKeyEncoding: { type: 'pkcs8', format: 'pem' },
});
console.log('Public key:', publicKey);
console.log('Private key:', privateKey); Common Pitfalls
Security Notes
Disclaimer
This tool is provided for educational and development purposes. Key generation security depends on the browser's cryptographic RNG implementation. For production systems, use well-audited key generation tools and follow NIST FIPS 186-5 guidelines.
Further Reading
- NIST FIPS 186-5 — Digital Signature Standard
- SEC 1: Elliptic Curve Cryptography
- RFC 8446 — The Transport Layer Security (TLS) Protocol Version 1.3
- Bitcoin Wiki — secp256k1
Related Concepts
- ECDH Key Exchange — Derive shared secrets using ECC key pairs
- Ed25519 Sign/Verify — Modern EdDSA signatures (Curve25519)
- Digital Signature Verify — Verify ECDSA signatures with multiple curves
Related Tools
Need RSA keys instead? Try the RSA Key Generator. For interactive ECDH key exchange demonstrations, see the ECDH Key Exchange tool. For digital signatures with ECDSA, see the Digital Signature & Verify tool.
Frequently Asked Questions
Which curve should I choose?
P-256 is the safe default — it backs TLS certificates, JWT ES256, and most standard libraries. Pick P-384 or P-521 when you need a larger security margin (government, payment, or long-lived keys). Choose secp256k1 only for Bitcoin/Ethereum interoperability. Browsers implement the three NIST curves natively; secp256k1 runs through the audited @noble/curves library bundled into this page. Note that a bare hex scalar is curve-agnostic, so the tool assumes P-256 for raw hex input — use a PEM file when the curve matters.
How do I sign and verify with OpenSSL?
Save the PEM files, then sign with: openssl dgst -sha256 -sign private.pem -out message.sig message.txt — and verify with: openssl dgst -sha256 -verify public.pem -signature message.sig message.txt. OpenSSL emits ASN.1 DER signatures while Web Crypto emits raw r‖s; the Verify tab accepts and auto-detects both, so signatures cross over in either direction.
What is the recoverable signature format?
It is a raw r‖s signature with one extra leading byte (the recovery id) that lets anyone re-derive the signer's public key from the signature and message alone — the trick Bitcoin and Ethereum use to embed signer identity in transactions. The Sign tab prints it alongside the plain encodings; dropping the first byte returns the ordinary raw signature.
Can I derive ECDH shared secrets here?
Yes. In the ECDH tab, paste your private key and the peer's public key (any format) and the tool computes the shared secret — the bare X coordinate, matching Web Crypto and Node.js — plus its SHA-256 as ready-to-use symmetric key material. Both sides land on the same secret without ever transmitting it.
What export format should I use?
PKCS#8 PEM is the universal choice — servers, JWT libraries, and OpenSSL all accept it. JWK is best for JavaScript code and JWT headers. SEC1 PEM is traditional for OpenSSL and blockchain toolchains. Raw hex is for scripts and blockchain tools. Public keys additionally show the compressed form (33-byte 02/03-prefixed point).
Privacy: This tool runs entirely in your browser — nothing is uploaded or stored. · Disclaimer: For educational purposes only. Not professional security advice.
More in Key Exchange
RSA Key Generator
Generate RSA key pairs online in PEM, DER, JWK, SSH, or PKCS#1 format. Batch generation, passphrase encryption, key import.
ECDH Key Exchange
Perform ECDH key exchange online across P-256, P-384, P-521, secp256k1, and X25519. Compute shared secrets, derive symmetric keys.
ML-KEM Key Encapsulation
Generate ML-KEM (FIPS 203) post-quantum key pairs online. Encapsulation and decapsulation with ML-KEM-512/768/1024, hex and Base64 output.