Cryptographic Prime Number Generator

Generate large random prime numbers (8–2048 bits) using the Miller-Rabin probabilistic primality test — entirely in your browser.

Generator Settings

bits (8 – 2048)

Choose a bit length and click Generate Prime

Copied!

Summary

Generate large random prime numbers (8–2048 bits) using the Miller-Rabin probabilistic primality test — entirely in your browser.

How it works

  1. Choose a bit length between 8 and 2048 using the slider or input field.
  2. Select the number of Miller-Rabin rounds (more rounds = higher certainty, slower).
  3. Click "Generate Prime" to search for a random prime of that size.
  4. The result displays in decimal and hexadecimal. A confidence estimate is shown.
  5. Click "Copy" next to either format to copy the value to your clipboard.
  6. Click "Generate Again" to find a different prime of the same bit length.

Use cases

  • Generate candidate primes for RSA key pairs during cryptography coursework.
  • Test primality implementations against known-prime ground truth.
  • Produce large primes for Diffie-Hellman key exchange prototypes.
  • Explore how prime density changes across bit lengths.
  • Benchmark browser BigInt performance on Miller-Rabin iterations.
  • Demonstrate probabilistic primality testing to students.

Frequently Asked Questions

Last updated: 2026-06-11 · Reviewed by Nham Vu