ECC Key Generator Online | ECDSA P-256, P-384, P-521, secp256k1

Key Exchange
100% client-side. Processed locally in your browser using the Web Crypto API. Nothing is sent to any server.
⚠️ Critical Security: Store private keys securely — never share or commit them. P-256 is sufficient for most applications (128-bit security). Verify public key fingerprints through a separate trusted channel before exchanging keys. For post-quantum security, consider ML-KEM (FIPS 203).

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

CurveKey SizeSecurity LevelRSA EquivalentBest for
P-256256-bit128-bit~3072-bitTLS, JWT ES256, general-purpose
P-384384-bit192-bit~7680-bitGovernment, payment, JWT ES384
P-521521-bit256-bit~15360-bitMaximum security, JWT ES512
secp256k1256-bit128-bit~3072-bitBitcoin, 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

⚠️ Using secp256k1 for Non-Blockchain Use: secp256k1 is the Bitcoin/Ethereum curve. For TLS, JWT, and general-purpose applications, use NIST curves (P-256/P-384) which have wider browser and library support.
⚠️ Not Protecting Private Keys: ECC private keys are small (just 32 bytes for P-256) but extremely sensitive. Never share them, commit them to version control, or leave them in world-readable files.
⚠️ Confusing PEM Formats: PKCS#8 ("BEGIN PRIVATE KEY") and SEC1 ("BEGIN EC PRIVATE KEY") are different formats for the same key. Most modern tools prefer PKCS#8, but OpenSSL and blockchain tools may use SEC1.
⚠️ Not Verifying Public Key Fingerprints: When exchanging keys, always verify the SHA-256 fingerprint through a separate trusted channel. Without verification, a man-in-the-middle could substitute their own key.
⚠️ Raw Hex Scalars Are Curve-Agnostic: A bare hex private key doesn't encode which curve it belongs to. Always use PEM format when the curve matters, or explicitly document which curve the hex key is for.

Security Notes

ℹ️ P-256 Is Sufficient for Most Use Cases: Larger curves (P-384, P-521) add marginal security at the cost of slower operations and larger signatures. P-256 provides 128-bit security, equivalent to AES-128.
ℹ️ ECC vs RSA Efficiency: A P-256 key (256-bit) provides the same security as an RSA-3072 key (3072-bit). ECC signatures are ~64 bytes vs RSA-2048 signatures at ~256 bytes.
ℹ️ Recoverable Signatures for Blockchain: The recoverable signature format includes an extra byte (recovery id) that lets anyone re-derive the signer's public key — this is how Bitcoin and Ethereum embed signer identity in transactions.
ℹ️ ECDH Shared Secrets: The ECDH tab computes shared secrets without transmitting them. Always hash the raw secret with SHA-256 or use HKDF before using it as an encryption key.

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

Related Concepts

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

Learn More