Prime Number Checker

This tool checks whether an integer is prime or composite and explains the divisibility checks used to decide. It tests only the divisors that matter up to $\sqrt{n}$. If the number is composite, it also shows the smallest divisor so you can immediately see a factor pair. Prime checking is useful for factoring, simplifying fractions, and many algebra routines. For more factor and divisibility tools, explore Number Theory.

Check whether an integer is prime.

Integer values only. Decimals are not allowed.

What Is a Prime Number?

A prime number is a positive integer greater than $1$ that has exactly two positive divisors: $1$ and itself. Numbers greater than $1$ that have additional divisors are called composite. The number $1$ is neither prime nor composite.

How Prime Checking Works

The fastest basic method for a single number is divisibility testing. If $n$ has a divisor other than $1$ and itself, it must have one that is at most $\sqrt{n}$. That means you only need to check potential divisors up to $\sqrt{n}$.

Why the $\sqrt{n}$ Limit Is Enough

If $n$ is composite, you can write it as $n = a·b$ with $1$ < $a$ ≤ $b$ < $n$. At least one of $a$ or $b$ must be ≤ $\sqrt{n}$, otherwise their product would exceed $n$. So if you find no divisor ≤ $\sqrt{n}$, $n$ is prime.

If you are simplifying ratios or reducing fractions, the GCD Calculator helps you remove common factors. When you need the smallest common denominator for fractions, the LCM Calculator is the right tool.

Common Edge Cases

  • $n$ ≤ $1$: not prime.
  • $n$ = $2$ or $n$ = $3$: prime.
  • Even numbers greater than $2$: composite.
  • Negative integers: not prime (primes are defined over positive integers).

What the Results Mean

If the tool returns Prime, it means no divisor was found after testing only the values that matter up to the square root of $n$. For a prime number, the only positive divisors are $1$ and itself.

If the tool returns Composite, it will also show the smallest divisor. That divisor is the first number greater than $1$ that divides $n$ exactly, and it immediately gives you a factor pair. This is useful when you need to factor numbers, reduce fractions, or simplify algebraic expressions.

If $n$ is $0$, $1$, or negative, the tool will mark it as not prime because primes are defined only for positive integers greater than $1$.

Worked Examples

Example 1: A prime number

Check $29$. Since it is not even and not divisible by $3$, test the next candidates up to $\sqrt{29}$ (which is a bit more than $5$). The only remaining divisor to test is $5$, and $29$ is not divisible by $5$.

Conclusion: $29$ is prime.

Example 2: A composite number

Check $91$. It is not even, and $9+1=10$ so it is not divisible by $3$. Try $5$ (no), then $7$: $91$ ÷ $7$ = $13$, so $7$ divides $91$.

$$91 = 7 \cdot 13$$ Conclusion: $91$ is composite, and the smallest divisor is $7$.

Example 3: Not prime by definition

Check $1$. Prime numbers must be greater than $1$, so $1$ is not prime. It is also not composite because it does not have two different positive divisors.

Conclusion: $1$ is neither prime nor composite.

Keep exploring Mathematics or jump back to Calculators to browse more tools.

Questions About the Prime Checker

Quick answers about primes, composites, and divisibility.

Trusted by thousands of users every month. Fast, accurate and privacy-friendly tools.