🔍
✓ Editorially reviewed by Derek Giordano, Founder & Editor · BA Business Marketing

Prime Factorization Calculator

Break Any Number Into Prime Factors

Last reviewed: April 2026

🧮
500 calculators, no signup required
Finance · Health · Math · Science · Business
nnng.com

What Is Prime Factorization?

Prime factorization breaks any composite number into the product of its prime factors — the fundamental building blocks of all integers. Every integer greater than 1 is either prime (divisible only by 1 and itself) or can be expressed as a unique product of primes (the Fundamental Theorem of Arithmetic). For example, 84 = 2² × 3 × 7. This decomposition is unique for every number and has profound applications in cryptography, number theory, and computer science. For related tools, see our Combination Calculator and Statistics Calculator.

How the Algorithm Works

Trial division is the simplest method: divide by 2, then 3, then 5, and continue through successive primes up to the square root of the number. Each time a prime divides evenly, record it and continue dividing. If a remainder greater than 1 exists after reaching the square root, it's itself a prime factor. This calculator handles numbers up to 1 billion efficiently. For much larger numbers, more advanced algorithms like Pollard's rho or the quadratic sieve are needed.

Applications of Prime Factorization

RSA encryption — the foundation of internet security — relies on the difficulty of factoring very large numbers (hundreds of digits). Finding GCD and LCM uses prime factorizations. Simplifying fractions requires finding common factors. In music theory, frequency ratios of harmonious intervals are small prime ratios. Understanding prime factorization builds mathematical intuition that applies across disciplines.

Prime Factorization Examples

NumberPrime FactorsExponent Form
122 × 2 × 32² × 3
602 × 2 × 3 × 52² × 3 × 5
1002 × 2 × 5 × 52² × 5²
3602 × 2 × 2 × 3 × 3 × 52³ × 3² × 5
1,0002 × 2 × 2 × 5 × 5 × 52³ × 5³

The Fundamental Theorem of Arithmetic

Every integer greater than 1 is either a prime number or can be represented as a unique product of prime factors, regardless of the order. This statement — the Fundamental Theorem of Arithmetic — is one of the most important results in all of mathematics. "Unique" means there is exactly one way to factor any number into primes (ignoring order): 360 is always 2³ × 3² × 5, never something else. This uniqueness is what makes prime factorization so powerful as a mathematical tool. It underlies the structure of divisibility, the computation of greatest common divisors and least common multiples, and the security of modern encryption systems.

Finding Prime Factors Step by Step

The trial division method works by systematically dividing the number by the smallest available prime. Start with 2 and keep dividing as long as it divides evenly. Then move to 3, then 5, then 7, and continue through successive primes. You only need to test primes up to the square root of the remaining number — if no prime up to that point divides it, the remaining number is itself prime. For example, factoring 360: divide by 2 → 180, by 2 → 90, by 2 → 45 (no more 2s), by 3 → 15, by 3 → 5, and 5 is prime. Result: 2³ × 3² × 5. The square root optimization is critical for efficiency — to factor a number up to 1 billion, you only need to test primes up to 31,623.

Prime Numbers Reference

RangeCount of PrimesNotable Primes
1–100252, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97
100–20021101, 103, 107, 109, 113, 127, 131, ...
200–50042211, 223, 227, 229, 233, ...
500–1,00073503, 509, 521, 523, ...

GCD and LCM from Prime Factorization

Prime factorization provides the most intuitive method for computing the greatest common divisor (GCD) and least common multiple (LCM) of two or more numbers. The GCD takes the minimum exponent of each shared prime factor, while the LCM takes the maximum exponent of every prime factor present in any of the numbers. For 360 (2³ × 3² × 5) and 504 (2³ × 3² × 7): GCD = 2³ × 3² = 72 (shared factors at minimum powers), LCM = 2³ × 3² × 5 × 7 = 2,520 (all factors at maximum powers). This method scales to any number of integers and provides clear insight into why the GCD and LCM have the values they do.

Prime Factorization in Cryptography

RSA encryption — the algorithm securing most internet transactions, email encryption, and digital signatures — depends entirely on the difficulty of factoring large numbers. RSA works by multiplying two very large prime numbers (each 150+ digits) to produce a public key. Encrypting a message using this public key is easy (multiplication), but decrypting it requires knowing the original prime factors — and no known algorithm can factor a 300-digit number in a reasonable time using current computers. The largest RSA number ever factored (RSA-250, 250 digits) required approximately 2,700 CPU-core-years of computation in 2020. Current RSA keys use 2,048-bit or 4,096-bit keys (617 or 1,234 digits), which are far beyond the reach of classical factoring algorithms. Quantum computers running Shor's algorithm could theoretically factor these numbers efficiently, which is why the cryptography community is actively developing post-quantum encryption standards.

Divisibility Rules Using Prime Factors

Understanding prime factors illuminates common divisibility rules. A number is divisible by 6 if and only if it is divisible by both 2 and 3 (the prime factors of 6). Divisibility by 12 requires factors of 2² and 3. Divisibility by 15 requires factors of 3 and 5. These rules extend to any composite number: to check if N is divisible by some composite C, verify that N's prime factorization includes all of C's prime factors at equal or greater exponents. For quick divisibility checks: divisible by 2 if the last digit is even; by 3 if digit sum is divisible by 3; by 5 if the last digit is 0 or 5; by 7 requires actual division or the doubling-subtraction trick; by 11 if the alternating digit sum is divisible by 11.

Simplifying Fractions with Prime Factors

To simplify any fraction to its lowest terms, find the prime factorization of both the numerator and denominator, then cancel all shared factors. For 84/120: 84 = 2² × 3 × 7, and 120 = 2³ × 3 × 5. Cancel the shared 2² and 3 to get 7/10. This method always produces the correct simplified fraction in one step, unlike the repeated division approach where you might simplify 84/120 → 42/60 → 21/30 → 7/10 in three steps. For fractions with large numbers, prime factorization is the most reliable simplification method because it identifies the complete GCD immediately.

How to Use This Calculator

  1. Enter any positive integer — Type a number up to 1 billion to find its complete prime factorization.
  2. View the factors — The calculator shows the prime factorization in both expanded form (2 × 2 × 3 × 5) and exponent form (2² × 3 × 5).
  3. Apply the result — Use the factorization to simplify fractions, find GCD/LCM, check divisibility, or understand the number's structure.

Tips and Best Practices

Start with small primes. Always begin trial division with 2, then 3, then 5. These three primes alone factor out the majority of composite numbers you will encounter in everyday math.

Stop at the square root. You never need to test primes larger than √n. If no prime up to that point divides n, then n itself is prime.

Use factorization for LCM shortcut. Finding the LCM of multiple numbers by listing multiples is tedious. Prime factorization gives the answer directly by taking the highest power of each prime across all numbers.

See also: Combination Calculator · Binomial Probability · Binary Calculator · Equation Solver

Twin Primes and Prime Gaps

Twin primes are pairs of primes separated by exactly 2 — such as (3,5), (11,13), (17,19), (29,31), and (41,43). Whether infinitely many twin primes exist remains one of the great unsolved problems in mathematics (the twin prime conjecture). As numbers grow larger, primes become less frequent — the prime counting function π(n) approximates n/ln(n), meaning roughly 1 in every 23 numbers near 10 billion is prime. The gaps between consecutive primes grow on average but remain unpredictable in detail. The largest known prime, discovered in 2024, has over 41 million digits and was found using the Great Internet Mersenne Prime Search (GIMPS). These massive primes are Mersenne primes of the form 2^p − 1, where p is itself prime.

What is a prime number?
A prime number is a natural number greater than 1 that can only be divided evenly by 1 and itself. The first primes are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29. The number 2 is the only even prime.
Why is prime factorization important?
Prime factorization is fundamental to cryptography (RSA encryption), finding GCD and LCM, simplifying fractions, and number theory. All modern internet security relies on the difficulty of factoring very large numbers.
Is 1 a prime number?
No. By mathematical convention, 1 is neither prime nor composite. This definition ensures the uniqueness of prime factorization (the Fundamental Theorem of Arithmetic). For a related calculation, try our Prime Number Checker.
How do I find the prime factorization of a number?
Divide by the smallest prime (2) repeatedly until it no longer divides evenly. Then try 3, then 5, then 7, continuing with each prime. Record each factor. Example: 180 ÷ 2 = 90, 90 ÷ 2 = 45, 45 ÷ 3 = 15, 15 ÷ 3 = 5, 5 ÷ 5 = 1. So 180 = 2² × 3² × 5. Stop when the quotient reaches 1.
How is prime factorization used in encryption?
RSA encryption works by multiplying two large primes (each 300+ digits) to create a public key. Encrypting is easy (multiplication), but decrypting without the private key requires factoring the product back into its two prime components — a task that would take current computers billions of years for 2048-bit keys. This asymmetry between easy multiplication and hard factorization is the mathematical foundation of internet security.

How to Use This Calculator

  1. Enter any positive integer — Type a whole number to decompose into its prime factors.
  2. Review the factorization — Shows the complete product of primes — e.g., 360 = 2³ × 3² × 5.
  3. See the factor tree — Visually shows the step-by-step division process for students learning decomposition.
  4. Apply to related problems — Prime factorization is the foundation for GCD, LCM, fraction simplification, and perfect square tests.

Tips and Best Practices

Run multiple scenarios. Try different inputs to understand how each variable affects the result. This builds practical intuition beyond just getting a single answer.

Use accurate inputs for reliable results. The output is only as good as the input. Use measured values rather than rough estimates whenever possible.

Bookmark for quick access. Save this page for instant reference — no need to search for it again the next time you need this calculation.

Explore related tools. Check the related calculators section below for tools that complement this one — many calculations work best in combination.

See also: Permutation Calculator · GCD & LCM Calculator · Factorial & Combinations Calculator · Matrix Determinant Calculator · Binomial Probability Calculator

📚 Sources & References
  1. [1] Khan Academy. Prime Factorization. KhanAcademy.org
  2. [2] Wolfram MathWorld. Prime Factorization. MathWorld
  3. [3] NIST. Number Theory Standards. NIST.gov
  4. [4] OpenStax. Pre-Algebra — Factors. OpenStax.org
Editorial Standards — Every calculator is built from peer-reviewed formulas and official data sources, editorially reviewed for accuracy, and updated regularly. Read our full methodology · About the author