Prime Factor Calculator

Primality check, prime factorization, and full divisor list for positive integers up to one trillion.

Primality
Enter a number to check if it is prime.
First N primes (Sieve of Eratosthenes)

Frequently asked questions

A prime number is a positive integer greater than 1 that has exactly two positive divisors: 1 and itself. For example, 7 is prime because its only divisors are 1 and 7, while 6 is not prime because it is also divisible by 2 and 3. Primes are the building blocks of the integers: every integer greater than 1 can be written as a product of primes in essentially one way.
Historically 1 was sometimes called prime, but modern number theory excludes it so that the Fundamental Theorem of Arithmetic holds. If 1 were prime, the prime factorization of 6 could be written 2 · 3, or 1 · 2 · 3, or 1 · 1 · 2 · 3, and the decomposition would no longer be unique. Excluding 1 keeps factorizations clean and many theorems short.
Divide the number by the smallest prime that fits (starting with 2, then 3, 5, 7, 11, …), and repeat on the quotient until the quotient becomes 1. Every integer greater than 1 has exactly one such decomposition (up to order). For example, 60 ÷ 2 = 30, 30 ÷ 2 = 15, 15 ÷ 3 = 5, 5 is prime → 60 = 2 · 2 · 3 · 5 = 2² · 3 · 5.
Let σ(n) be the sum of all divisors of n including n itself, and s(n) = σ(n) − n be the sum of proper divisors. A number is perfect if s(n) = n (6, 28, 496, …), abundant if s(n) > n (12, 18, 20, …), and deficient if s(n) < n (most numbers, including all primes and prime powers).
As of the mid-2020s the largest known prime is a Mersenne prime of the form 2^p − 1 with tens of millions of decimal digits, discovered by the GIMPS distributed-computing project. Numbers that large are far beyond what any browser calculator can test directly, but the mathematics is identical to what you see here — just with very large exponents.
Prime factorization underpins most modern public-key cryptography: RSA security relies on the difficulty of factoring a product of two large primes. Factorizations are also used to simplify fractions, find greatest common divisors and least common multiples, analyze divisibility, and generate hash functions and pseudo-random sequences.
Uses trial division with a 6k±1 wheel for factorization and a deterministic Miller–Rabin test for primality. Accurate for integers up to 1012.

Check whether a number is prime, split any positive integer up to 1,000,000,000,000 into its prime factors, and list every divisor of the number in one place. The Is Prime? tab uses a deterministic Miller-Rabin test with bases up to 37, so results are guaranteed correct for values under 3.3 x 10^14. The Prime Factorization tab shows the result in exponent form, step-by-step division using a 6k plus or minus 1 wheel, and the number-of-divisors formula tau(n) = (e1+1)(e2+1)… For example, 60 = 2^2 * 3 * 5, and tau(60) = 3 * 2 * 2 = 12. The All Factors tab lists every divisor as clickable chips, shows sigma(n), and labels the number perfect, abundant, or deficient. A Sieve of Eratosthenes panel generates the first N primes for reference.