Prime Number Calculator

Enter any whole number and find out whether it's prime or composite. The Prime Number Calculator checks your number's primality, lists all its factors if composite, and shows the nearest prime numbers above and below it.

Enter any positive whole number to check if it is prime or composite.

Results

Result

--

Number of Factors

--

All Factors

--

Previous Prime

--

Next Prime

--

Results Table

Frequently Asked Questions

What is a prime number?

A prime number is a whole number greater than 1 that has exactly two distinct factors: 1 and itself. Examples include 2, 3, 5, 7, 11, and 13. A number with more than two factors is called a composite number.

Is 1 a prime number?

No, 1 is not a prime number. By definition, a prime must have exactly two distinct factors, but 1 has only one factor (itself). Mathematicians exclude 1 from primes to preserve the uniqueness of the Fundamental Theorem of Arithmetic.

What is a composite number?

A composite number is any positive integer greater than 1 that is not prime — meaning it has more than two factors. For example, 12 is composite because it is divisible by 1, 2, 3, 4, 6, and 12.

How does the prime number checker work?

The calculator uses trial division to test whether your number is divisible by any integer from 2 up to its square root. If no such divisor is found, the number is prime. If a divisor is found, all factors are listed and the number is flagged as composite.

Is 2 a prime number?

Yes, 2 is the only even prime number. Every other even number is divisible by 2, making it composite. That makes 2 unique as the smallest and only even member of the prime numbers.

Why are prime numbers important?

Prime numbers are the building blocks of all integers — every whole number greater than 1 can be expressed as a unique product of primes (the Fundamental Theorem of Arithmetic). They are also critical in cryptography: RSA encryption and many modern security systems rely on the difficulty of factoring large numbers into primes.

How many prime numbers are there?

There are infinitely many prime numbers. Euclid proved this over 2,000 years ago by showing that any finite list of primes can always be used to construct a new prime not on the list. The primes become less frequent as numbers grow larger, but they never stop.

What is the largest known prime number?

The largest known prime numbers are Mersenne primes, which have the form 2^p − 1. As of recent records, the largest known prime has tens of millions of digits and was discovered through the Great Internet Mersenne Prime Search (GIMPS) collaborative project.

More Math Tools