Skip to main content

Prime Number Calculator — primality test, factorization, range & N-th prime

Test primality · factorize · list primes in a range · find the N-th prime — exact BigInt math, browser-only

  • Runs locally
  • Category Calculator
  • Best for Getting a realistic range before a purchase, plan, workout, or schedule decision.

97 is prime

What this tool does

A four-in-one prime number toolkit that runs entirely in your browser. Mode 1 tells you whether a single number is prime: small inputs use trial division (and show you the smallest factor when it is composite), while numbers up to 18 digits use a deterministic Miller–Rabin test, so the answer is a proof, never a "probably prime" guess. Mode 2 returns the full prime factorization in exponent form, e.g. 360 = 2^3 · 3^2 · 5, using Pollard's rho so even a stubborn 15-digit semiprime cracks in a blink. Mode 3 lists every prime in a range [a, b] with the Sieve of Eratosthenes (span-capped so the tab never freezes), and Mode 4 returns the N-th prime directly — the 1000th prime is 7919, the 100000th is 1299709. Every result links to a shareable URL, every output has a one-click copy button, and all arithmetic uses JavaScript BigInt, so 19-digit inputs stay exact instead of silently rounding the way floating-point would.

Tool details

Input
Text + Numbers
The page exposes text boxes, numeric controls, file pickers, or structured inputs depending on the tool.
Output
Live result + Copy
The result area focuses on usable output, with copy, download, or preview actions when supported.
Privacy
Browser-side processing
The main tool logic does not call an external API, so inputs normally stay in the current tab.
Save / share
Shareable URL state
Key settings are encoded in the URL so another person can reopen the same setup.
Performance budget
Initial JS <= 10 KB
No WASM budget is declared, keeping the tool quick to open on mobile.
Best fit
Calculator · Student
Category and role tags drive related tools, internal links, and quick fit checks.

How to use

  1. 1. Input

    Paste or drop your content into the tool panel.

  2. 2. Process

    Click the button. All processing is local in your browser.

  3. 3. Copy / Download

    Copy the result or download to disk in one click.

How Prime Number Calculator fits into your work

Use it for fast estimates, comparisons, and planning numbers before you make the final call.

Calculation jobs

  • Getting a realistic range before a purchase, plan, workout, or schedule decision.
  • Comparing scenarios by changing one input at a time.
  • Turning rough assumptions into a number you can discuss.

Calculation checks

  • Double-check units, dates, rates, and rounding assumptions.
  • Treat health, finance, tax, and legal outputs as planning aids, not professional advice.
  • Save the inputs that produced an important result so you can reproduce it later.

Good next steps

These links move the current task into a more complete workflow.

  1. 1 GCD & LCM Calculator GCD + LCM of any list of integers — Euclidean steps, prime factorization, prime-factor table — exact BigInt math, browser-only Open
  2. 2 Scientific Calculator Scientific calculator — sin / cos / log / sqrt / power, with full keyboard input + history, deg/rad mode. Open
  3. 3 Number Base Converter Number base converter — binary, octal, decimal, hex, and any base 2-36. Bitwise too. Open

Real-world use cases

  • Pick safe primes for an RSA homework key

    A cryptography assignment asks you to generate an RSA key by hand with two distinct primes p and q. You guess two candidates around 6-7 digits, paste each into the primality-test mode, and get an instant yes/no — no "probably prime" hedging, because Miller–Rabin is deterministic at this size. If one is composite the tool shows the smallest factor so you know to bump it up. Then you compute n = p·q, and if you ever need to double-check the modulus did not accidentally share a factor, the factorization mode confirms n cleanly splits back into exactly p and q.

  • Check a student's prime factorization answer

    A worksheet asks "write 1260 as a product of primes". A student writes 2^2 · 3^2 · 5 · 7. You paste 1260 into the factorize mode and read back 2^2 · 3^2 · 5 · 7 — match. When a student gets it wrong (say they wrote 2^3 · 3 · 5 · 7), the side-by-side comparison makes the error obvious: the exponent on 2 is wrong. Because the output is in the same exponent notation textbooks use, you are grading against the exact form you taught, not a flat list of repeated factors.

  • Generate a prime test set for a coding interview

    You are writing a `isPrime()` function for a coding-interview prep session and need correct expected values. Use the range mode on [2, 100] to get the canonical first 25 primes for a unit-test fixture, then grab a few large primes from the N-th prime mode (e.g. the 10000th prime is 104729) to test the path your trial-division loop is slowest on. Having a trusted oracle means your test failures point at your bug, not at a wrong expected value you typed from memory.

  • Find a prime modulus for a hash table

    You are sizing a hash table and the textbook advice is "use a prime larger than your expected load to reduce clustering". You expect about 30,000 entries, so you open the range mode on [30000, 30050] and pick the first prime it lists (30011). Or use the N-th prime mode to walk primes near a power of two. Either way you get a verified prime in one click instead of eyeballing a number and hoping it has no small factors.

  • Sanity-check a number-theory conjecture by hand

    You are exploring twin primes (pairs that differ by 2) for a math club. Run the range mode on [1, 200] and scan the list for adjacent entries two apart — 3 and 5, 5 and 7, 11 and 13, 17 and 19, and so on. Because the sieve returns the complete, exact list with no gaps or probabilistic skips, you can trust the pattern you spot is real and not an artifact of a fast-but-approximate test.

Common pitfalls

  • Treating 1 as prime. It is not — a prime needs exactly two divisors and 1 has only one. Many hand-written sieves and homework answers wrongly include 1; this tool excludes it and tells you why.

  • Confusing "is prime" with "has no small factors". A number can pass a quick check against 2, 3, 5, 7 and still be composite (e.g. 121 = 11^2). Use the primality mode, which tests properly, rather than eyeballing small divisors.

  • Expecting the factorization of a giant prime to be instant. Proving a large number has no factors is the hard direction; if you only need yes/no, the primality-test mode is far faster than the factorize mode because it never has to find the factors.

Privacy

Every computation — trial division, Miller–Rabin, Pollard's rho, the Eratosthenes sieve, and the N-th prime search — is plain JavaScript that runs in your browser tab. No number you test ever leaves the page, there is no logging of what you factorized, and there is no external API call. The one thing to know: the shareable URL encodes your current input in the query string (e.g. ?m=factor&f=360), so if you paste a "share link" somewhere, the destination server's access log will record that number. For math homework that is harmless; if a value is sensitive (say a private RSA prime), copy the result manually instead of sharing the URL.

FAQ

Tool combos

Folks in your role tend to reach for these alongside this tool.

Made by Toolora · 100% client-side · Updated 2026-06-13