Prime Number Checker

Instantly check whether a number is prime, view its full prime factorization, and list every prime within a chosen range. A fast online prime checker based on divisibility.

How to Use

  1. Enter a number

    Type a positive integer to check for primality.

  2. Run the check

    Click the Check button to determine whether the number is prime.

  3. View results

    See the primality verdict, list of divisors, and prime factorization.

What is a prime number?

A prime number is a natural number greater than 1 whose only divisors are 1 and itself. Numbers with exactly two divisors, such as 2, 3, 5, 7, 11, and 13, are prime, while 4, 6, 8, and 9, which have three or more divisors, are classified as composite numbers.

Primes are like the 'atoms of multiplication' from which every natural number is built. According to the fundamental theorem of arithmetic, every natural number greater than 1 can be factored into a product of primes in exactly one way.

Why it matters

  • Cryptography: RSA public-key encryption draws its security from the difficulty of factoring the product of two large primes back into its factors.
  • Reducing fractions: Knowing the prime factors of the numerator and denominator lets you reduce a fraction to its lowest terms with ease.
  • Number theory: There are infinitely many primes (Euclid's proof), yet their distribution remains one of the great unsolved problems.

Calculation Formula

This checker applies trial division with the 6k±1 optimization. If n is composite, one of its divisors must be no greater than √n, so after first filtering by 2 and 3 it tests only i and i+2 starting from 5 while i*i ≤ n.

Key conditions: n < 2 → not prime, and if n % i === 0 ever holds true, the number is composite.

For example, since √97 ≈ 9.85, you only need to try dividing 97 by 2, 3, 5, and 7. None of them divide it evenly, so 97 is prime. By contrast, 91 gives 91 ÷ 7 = 13, so 91 = 7 × 13 and is composite.

Prime factorization divides by the smallest primes in turn, grouping repeated factors as powers. Example: 360 = 2³ × 3² × 5.

Frequently Asked Questions

What is a prime number?
A prime number is a natural number greater than 1 that is divisible only by 1 and itself. For example, 2, 3, 5, 7, 11, and 13 are prime. The number 1 is not prime, and 2 is the only even prime number.
Is 1 a prime number?
No, 1 is not a prime number. A prime must be a natural number greater than 1 with exactly two divisors—1 and itself—but 1 has only a single divisor. Excluding 1 from the primes is also what makes prime factorization unique.
How do you test whether a number is prime?
The most basic method is trial division. To check whether a number n is prime, you divide it by every integer from 2 up to √n; if any of them divides evenly, n is not prime. This calculator applies the 6k±1 optimization, testing only the candidates on either side of multiples of 6—such as 5, 7, 11, and 13—so it runs faster.
Why is it enough to check only up to √n?
If n is composite it can be written as n = a × b, and a and b cannot both be greater than √n—otherwise a × b would exceed n, a contradiction. So at least one divisor must be no greater than √n, and checking only up to that limit is sufficient.
What is prime factorization?
Prime factorization expresses a natural number as a product of primes. For example, 12 = 2² × 3 and 60 = 2² × 3 × 5. By the fundamental theorem of arithmetic, every natural number greater than 1 has exactly one prime factorization, ignoring the order of the factors.
Why is 2 the only even prime number?
Every even number except 2 has 2 as a divisor, so beyond 1 and itself it gains the extra divisor 2 and becomes composite. Only 2 has just the divisors 1 and 2, making it the sole even prime.
How do you find the previous and next prime?
This calculator steps up and down one number at a time from your input, repeating the primality test to find the nearest previous and next primes. For example, if you enter 100, it shows the previous prime 97 and the next prime 101.
How large a number can it test?
This checker handles natural numbers up to about one billion (1,000,000,000). Because the algorithm only checks the √n range, numbers of this size return results instantly. For much larger numbers, probabilistic primality tests such as Miller-Rabin are used.
Verified 2026 formulas

Related Calculators