Prime number checker

Enter a whole number to find out if it is prime, meaning its only divisors are 1 and itself. The test is exact, not probabilistic, within the tool range.

Loading the tool…

Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.

How to use it

  1. Enter number.
  2. The result appears straight away and updates as you edit.
  3. Copy the result, or copy a link that keeps the same values to share it.

How it is calculated

Miller-Rabin test with the prime bases 2 to 37, which is deterministic for every number below 3.3 × 10^24. A number is composite if it has a divisor between 2 and its square root.

Example

Inputs: Number = 91. Result: Result: Composite; Smallest prime factor: 7; Next prime: 97.

Limits and caveats

  • Accepts whole numbers from 0 to 10^15.
  • By definition 0 and 1 are neither prime nor composite.

Questions about this tool

Is 1 a prime number?

No. A prime has exactly two distinct divisors, 1 and itself, and 1 has only one divisor.

Is 2 prime?

Yes, and it is the only even prime, since every other even number is divisible by 2.

Why is 91 not prime?

Because 91 = 7 × 13. The tool shows the smallest prime factor so you can see the reason at once.