Math calculator

Free prime factorization calculator

Find the prime factorization of any number — enter a whole number to see it broken into its prime factors, updated live, as you type.

InputsLive
Number (n)
Enter a positive integer (2 or greater).
Result
Prime factorization
2^3 × 3^2 × 5
360 = 2^3 × 3^2 × 5
Number (n)360
Prime factors3
Largest prime5
Factorization2^3 × 3^2 × 5

Trial division method. Based on the Fundamental Theorem of Arithmetic (Euclid, Elements VII.31): every integer > 1 has a unique prime factorization.

Results are estimates. Consult a professional.

How it's calculated

How the prime factorization calculator works

Prime factorization expresses any integer greater than 1 as a product of prime numbers. The algorithm repeatedly divides the number by the smallest prime that divides it evenly, starting with 2, until the quotient reaches 1. The result is written as a product of prime powers.

Algorithm (trial division):
1. Start with divisor p = 2
2. While n > 1:
if p divides n evenly → record p, set n = n / p
else → increment p to the next prime
3. Write result as p₁ᵃ × p₂ᵇ × p₃ᶜ ×
Wolfram MathWorld — Prime Factorization
Example

Worked example: factorising 360 and 84

Example: 360 = ? and 84 = ?

Divide repeatedly by the smallest prime at each step. 360: 360÷2=180, 180÷2=90, 90÷2=45, 45÷3=15, 15÷3=5, 5÷5=1. 84: 84÷2=42, 42÷2=21, 21÷3=7, 7÷7=1.

360 = 2 × 2 × 2 × 3 × 3 × 5 =×× 5
84 = 2 × 2 × 3 × 7 =× 3 × 7
GCF(360, 84) =× 3 = 12
LCM(360, 84) =×× 5 × 7 = 2520
360 = 2³ × 3² × 5
Once factorised, finding the GCF and LCM of any two numbers becomes a matter of comparing exponents — no long division needed.
Quick reference

Prime factorizations of 2–30

Every composite number in the table below can be built from the primes listed. Prime numbers appear with only themselves as factors.

NumberPrime factorizationNumberPrime factorization
22 (prime)1717 (prime)
33 (prime)182 × 3²
41919 (prime)
55 (prime)202² × 5
62 × 3213 × 7
77 (prime)222 × 11
82323 (prime)
9242³ × 3
102 × 525
1111 (prime)262 × 13
122² × 327
1313 (prime)282² × 7
142 × 72929 (prime)
153 × 5302 × 3 × 5
162⁴

Source: computed by trial division; primes sourced from the Sieve of Eratosthenes

Practical tips

Tips for prime factorization

Prime factorization is a foundational skill for simplifying fractions, finding GCF/LCM, and working with square roots. These shortcuts will speed up manual work.

  • Use divisibility rules first — even → divisible by 2; digit sum divisible by 3 → divisible by 3; ends in 0 or 5 → divisible by 5.
  • You only need to test primes up to √n — if no prime ≤ √n divides n, then n is prime (e.g. to test 97, only check 2, 3, 5, 7).
  • A factor tree is a visual alternative — split any composite into two factors, then keep splitting each branch until every node is prime.
  • Prime factorization simplifies square roots — √72 = √(2³×3²) = √(4×9×2) = 6√2; group prime pairs under the radical.
  • LCM and GCF in one step — once you have prime factorizations of two numbers, GCF = product of shared primes (min exponents) and LCM = product of all primes (max exponents).
Accuracy & limits

Accuracy and limitations

Trial division, the method used here, is exact for all integers. It is efficient for numbers up to roughly 10¹² on modern hardware. For very large numbers (15+ digits), trial division becomes slow; the calculator switches to a Miller-Rabin primality test combined with Pollard's rho algorithm for faster factorisation. Inputs must be positive integers greater than 1. The number 1 has no prime factors by convention, and 0 is undefined.

Glossary

Key terms

An integer greater than 1 with exactly two divisors: 1 and itself (e.g. 2, 3, 5, 7, 11).
An integer greater than 1 that has at least one divisor other than 1 and itself.
The unique expression of a composite number as a product of primes, e.g. 12 = 2² × 3.
The largest integer that divides two or more numbers evenly; also called GCD.
The smallest positive integer that is a multiple of two or more numbers.
Every integer > 1 is either prime or can be written as a unique product of primes (order aside).
About

About this calculator

Part of our math calculators suite — explore all calculators.

Questions

Frequently asked questions about the free prime factorization calculator

A prime factorization calculator is a free online tool that helps you decompose any positive integer into its unique prime factors using the Euclidean trial-division algorithm. Every integer greater than 1 factors uniquely (up to order) into a product of primes. The calculator performs trial division by successive primes up to √n. It runs entirely in your browser with instant results and no sign-up.
Yes — up to order. The Fundamental Theorem of Arithmetic guarantees that every integer > 1 has exactly one prime factorization (ignoring the order of factors). For example, 12 = 2 × 2 × 3 always, regardless of how you derive it.
There isn't one. By convention, 1 is the 'empty product' and has no prime factors. Similarly, 0 has no meaningful prime factorization (any prime times anything is non-zero).
Trial division is O(√n). For n up to ~10¹² it runs in microseconds. For numbers with 20+ digits, more sophisticated algorithms (Pollard's rho, GNFS) are needed; this calculator doesn't attempt those.

Want a calculator built for your business?

Customize any of our 400+ tools to match your brand, or commission a new one tailored to how your business actually calculates — pricing, payroll, quotes, anything. Deployed on your domain, math runs in your visitors' browsers.