Toolbox Hub
All Tools

Prime Number Checker

Check prime numbers

Check prime numbers Runs locally in your browser

Enter a whole number of 2 or more.

About the

The Prime Number Checker tells you whether a whole number is prime, and when it is not, it names a divisor as proof. That second part is the useful bit: a claim that a number is composite is easy to verify when you are shown the factor. The check tests divisors up to the square root of the number, which is why it returns an answer immediately even for large values.

Where people use the

  • Checking a number during a maths exercise or a homework problem.
  • Choosing a prime for a hash table size or a modulo operation.
  • Verifying a factor you suspect divides a number.
  • Exploring which numbers near a given value are prime.

How to use the

  1. 1

    Enter a whole number

    Type any integer of 2 or more. Decimals are not accepted.

  2. 2

    Run the check

    The result says whether the number is prime, or names a divisor that proves it is not.

  3. 3

    Use the divisor as proof

    If a divisor is reported, dividing the number by it confirms the answer immediately.

  4. 4

    Try nearby values

    Run a few numbers either side if you are hunting for the next prime.

Tips and best practices

  • The reported divisor is your proof; divide by it to confirm the result.
  • Keep to numbers up to about fifteen digits for an instant answer.
  • Remember 1 is not prime, and neither is any negative number.

Frequently asked questions

Why does it stop at the square root?

Because if a number has a factor larger than its square root, it must also have one smaller. Testing up to the square root is therefore enough, and much faster.

Is 1 prime?

No. By definition a prime has exactly two distinct divisors, and 1 has only one. The tool asks for a number of 2 or more.

Are negative numbers handled?

No. Primality is defined for positive integers above 1.

What about very large numbers?

Testing up to the square root is fast for numbers up to around fifteen digits. Beyond that the trial division gets slow, and a probabilistic test is the usual answer.

What is the largest known prime?

It changes as records are set. This tool checks a number you give it rather than searching for primes.

Related Tools