Prime Factorization Calculator: Finally Break Down Numbers into Primes
Let me tell you about the first time I needed prime factorization. I was simplifying fractions and working with square roots, and my teacher said, "Break it down into its prime factors." I had no idea what that meant or why it mattered.
Then I learned: prime factorization is like finding the DNA of a number—every whole number is built from unique prime building blocks. And once you understand this, simplifying fractions, finding square roots, and working with radicals becomes easy.
In this guide, I'll walk you through everything you need to know about prime factorization—from basic division steps to factor trees, exponents, and the Fundamental Theorem of Arithmetic.
Ready to master prime factorization? Try our Prime Factorization Calculator and watch each division step unfold before your eyes.
What Is Prime Factorization?
Prime factorization is the process of breaking down a number into its prime building blocks—the smallest prime numbers that multiply together to give the original number.
Simple Example
360 = 2 × 2 × 2 × 3 × 3 × 5 = 2³ × 3² × 5
Another Example
84 = 2 × 2 × 3 × 7 = 2² × 3 × 7
Why It's Called "Factorization"
Just like you can factor 12 as 3 × 4, prime factorization breaks it down until all factors are prime numbers that can't be broken further.
The Fundamental Theorem of Arithmetic
This is one of the most important theorems in number theory:
Every integer greater than 1 is either prime itself or can be uniquely represented as a product of primes, regardless of the order.
What This Means
- Every number has exactly one prime factorization (order doesn't matter)
- Primes are the "atoms" or "building blocks" of all numbers
- There's no other way to break down a number into primes
Examples of Uniqueness
| Number | Prime Factorization |
|---|---|
| 12 | 2² × 3 (only one way) |
| 18 | 2 × 3² (only one way) |
| 30 | 2 × 3 × 5 (only one way) |
| 100 | 2² × 5² (only one way) |
No matter how you factor 12 (3 × 4, 2 × 6, etc.), when you break it down completely, you always get 2 × 2 × 3.
Why Prime Factorization Matters
| Application | How Prime Factorization Helps |
|---|---|
| Simplifying fractions | Find GCD of numerator and denominator |
| Finding square roots | Simplify √72 = √(2³ × 3²) = 6√2 |
| Finding LCM | Take highest powers of all primes |
| Finding GCD | Take lowest powers of common primes |
| Cryptography | RSA encryption relies on factoring difficulty |
| Number theory | Understanding number properties |
How to Do Prime Factorization: 3 Methods
Method 1: Repeated Division (Step-by-Step)
This is the method our calculator uses—simple and visual.
Example: Factor 360
| Step | Divide | Result | Prime Factor |
|---|---|---|---|
| 1 | 360 ÷ 2 = 180 | 180 | 2 |
| 2 | 180 ÷ 2 = 90 | 90 | 2 |
| 3 | 90 ÷ 2 = 45 | 45 | 2 |
| 4 | 45 ÷ 3 = 15 | 15 | 3 |
| 5 | 15 ÷ 3 = 5 | 5 | 3 |
| 6 | 5 ÷ 5 = 1 | 1 | 5 |
Result: 2³ × 3² × 5
Method 2: Factor Tree
A visual way to break down numbers:
360
/ \
36 10
/ \ / \
6 6 2 5
/ \ / \
2 3 2 3
Collecting primes: 2, 2, 2, 3, 3, 5 → 2³ × 3² × 5
Method 3: Division Ladder
A compact way to show repeated division:
2 | 360
2 | 180
2 | 90
3 | 45
3 | 15
5 | 5
| 1
Step-by-Step Examples
Example 1: 84 (Composite Number)
Input: 84
Step-by-step division:
| Step | Division | Result |
|---|---|---|
| 1 | 84 ÷ 2 = 42 | 42 |
| 2 | 42 ÷ 2 = 21 | 21 |
| 3 | 21 ÷ 3 = 7 | 7 |
| 4 | 7 ÷ 7 = 1 | 1 |
Prime factorization: 2 × 2 × 3 × 7 = 2² × 3 × 7
Check: 4 × 21 = 84 ✓
Example 2: 360
Step-by-step:
| Step | Division | Result |
|---|---|---|
| 1 | 360 ÷ 2 = 180 | 180 |
| 2 | 180 ÷ 2 = 90 | 90 |
| 3 | 90 ÷ 2 = 45 | 45 |
| 4 | 45 ÷ 3 = 15 | 15 |
| 5 | 15 ÷ 3 = 5 | 5 |
| 6 | 5 ÷ 5 = 1 | 1 |
Result: 2³ × 3² × 5
Example 3: 100
| Step | Division | Result |
|---|---|---|
| 1 | 100 ÷ 2 = 50 | 50 |
| 2 | 50 ÷ 2 = 25 | 25 |
| 3 | 25 ÷ 5 = 5 | 5 |
| 4 | 5 ÷ 5 = 1 | 1 |
Result: 2² × 5²
Example 4: 97 (Prime Number)
| Step | Division | Result |
|---|---|---|
| 1 | 97 ÷ 2 = not integer | - |
| 2 | Check up to √97 ≈ 9.8 | No divisors found |
| 3 | 97 ÷ 97 = 1 | 1 |
Result: 97 is PRIME (only factors: 1 and 97)
Example 5: 256 (Power of 2)
| Step | Division | Result |
|---|---|---|
| 1 | 256 ÷ 2 = 128 | 128 |
| 2 | 128 ÷ 2 = 64 | 64 |
| 3 | 64 ÷ 2 = 32 | 32 |
| 4 | 32 ÷ 2 = 16 | 16 |
| 5 | 16 ÷ 2 = 8 | 8 |
| 6 | 8 ÷ 2 = 4 | 4 |
| 7 | 4 ÷ 2 = 2 | 2 |
| 8 | 2 ÷ 2 = 1 | 1 |
Result: 2⁸
Prime Factorization of Common Numbers
| Number | Prime Factorization | Number | Prime Factorization |
|---|---|---|---|
| 2 | 2 (prime) | 50 | 2 × 5² |
| 3 | 3 (prime) | 64 | 2⁶ |
| 4 | 2² | 72 | 2³ × 3² |
| 5 | 5 (prime) | 81 | 3⁴ |
| 6 | 2 × 3 | 84 | 2² × 3 × 7 |
| 7 | 7 (prime) | 96 | 2⁵ × 3 |
| 8 | 2³ | 100 | 2² × 5² |
| 9 | 3² | 108 | 2² × 3³ |
| 10 | 2 × 5 | 120 | 2³ × 3 × 5 |
| 11 | 11 (prime) | 125 | 5³ |
| 12 | 2² × 3 | 128 | 2⁷ |
| 13 | 13 (prime) | 144 | 2⁴ × 3² |
| 14 | 2 × 7 | 150 | 2 × 3 × 5² |
| 15 | 3 × 5 | 169 | 13² |
| 16 | 2⁴ | 180 | 2² × 3² × 5 |
| 17 | 17 (prime) | 200 | 2³ × 5² |
| 18 | 2 × 3² | 216 | 2³ × 3³ |
| 19 | 19 (prime) | 225 | 3² × 5² |
| 20 | 2² × 5 | 243 | 3⁵ |
| 21 | 3 × 7 | 256 | 2⁸ |
| 22 | 2 × 11 | 288 | 2⁵ × 3² |
| 23 | 23 (prime) | 300 | 2² × 3 × 5² |
| 24 | 2³ × 3 | 324 | 2² × 3⁴ |
| 25 | 5² | 343 | 7³ |
| 26 | 2 × 13 | 360 | 2³ × 3² × 5 |
| 27 | 3³ | 400 | 2⁴ × 5² |
| 28 | 2² × 7 | 432 | 2⁴ × 3³ |
| 29 | 29 (prime) | 441 | 3² × 7² |
| 30 | 2 × 3 × 5 | 500 | 2² × 5³ |
| 31 | 31 (prime) | 512 | 2⁹ |
| 32 | 2⁵ | 576 | 2⁶ × 3² |
| 33 | 3 × 11 | 625 | 5⁴ |
| 34 | 2 × 17 | 648 | 2³ × 3⁴ |
| 35 | 5 × 7 | 720 | 2⁴ × 3² × 5 |
| 36 | 2² × 3² | 729 | 3⁶ |
| 37 | 37 (prime) | 768 | 2⁸ × 3 |
| 38 | 2 × 19 | 800 | 2⁵ × 5² |
| 39 | 3 × 13 | 840 | 2³ × 3 × 5 × 7 |
| 40 | 2³ × 5 | 900 | 2² × 3² × 5² |
| 41 | 41 (prime) | 1000 | 2³ × 5³ |
| 42 | 2 × 3 × 7 | 1024 | 2¹⁰ |
| 43 | 43 (prime) | 1080 | 2³ × 3³ × 5 |
| 44 | 2² × 11 | 1152 | 2⁷ × 3² |
| 45 | 3² × 5 | 1296 | 2⁴ × 3⁴ |
| 46 | 2 × 23 | 1440 | 2⁵ × 3² × 5 |
| 47 | 47 (prime) | 1728 | 2⁶ × 3³ |
| 48 | 2⁴ × 3 | 2048 | 2¹¹ |
| 49 | 7² | 2400 | 2⁵ × 3 × 5² |
Using Prime Factorization to Simplify Radicals
Prime factorization is essential for simplifying square roots.
The Rule
√(a × a × b) = a√b
Examples
√72
- 72 = 2³ × 3²
- √72 = √(2² × 2 × 3²) = 2 × 3 × √2 = 6√2
√180
- 180 = 2² × 3² × 5
- √180 = 2 × 3 × √5 = 6√5
√288
- 288 = 2⁵ × 3²
- √288 = √(2⁴ × 2 × 3²) = 2² × 3 × √2 = 12√2
³√216 (cube root)
- 216 = 2³ × 3³
- ³√216 = 2 × 3 = 6
Using Prime Factorization for GCD and LCM
Finding GCD (Greatest Common Divisor)
Take the minimum power of each common prime.
Example: GCD(72, 180)
- 72 = 2³ × 3²
- 180 = 2² × 3² × 5
- Common primes: 2² × 3² = 4 × 9 = 36
Finding LCM (Least Common Multiple)
Take the maximum power of each prime.
Example: LCM(72, 180)
- 72 = 2³ × 3²
- 180 = 2² × 3² × 5
- LCM = 2³ × 3² × 5 = 8 × 9 × 5 = 360
Relationship
LCM(a, b) × GCD(a, b) = a × b
- 360 × 36 = 12,960
- 72 × 180 = 12,960 ✓
How to Use Our Prime Factorization Calculator
Step 1: Enter a Number
Type any integer greater than 1. Example: 360
Step 2: Click Factorize
The calculator performs repeated division starting from the smallest prime (2).
Step 3: Read Your Results
You'll see:
- Prime factorization: With exponents (e.g., 2³ × 3² × 5)
- Prime/Composite classification: Whether the number is prime
- Step-by-step division: Each division shown sequentially
- Visual progress: See the number get smaller step by step
What It Handles
| Input | Example | Works? |
|---|---|---|
| Small numbers | 12, 24, 36 | ✓ |
| Large numbers | 10,000 | ✓ |
| Prime numbers | 97, 101, 997 | ✓ (shows as prime) |
| Powers of 2 | 256, 512, 1024 | ✓ |
| Perfect squares | 144, 400, 900 | ✓ |
| 1 | 1 | ⚠️ (prime factorization not defined) |
| 0 | 0 | ⚠️ (not defined) |
| Negative numbers | -12 | ⚠️ (use positive) |
Prime Factorization Algorithm
Our calculator uses an optimized trial division algorithm:
function factorize(n):
factors = []
divisor = 2
while divisor × divisor ≤ n:
if n % divisor == 0:
count = 0
while n % divisor == 0:
n = n / divisor
count++
factors.append(divisor, count)
divisor++
if n > 1:
factors.append(n, 1)
return factors
Complexity
| Number Size | Operations (worst case) | Time |
|---|---|---|
| 1,000 | ~1,000 | < 1ms |
| 100,000 | ~100,000 | ~10ms |
| 10,000,000 | ~10,000,000 | ~1 second |
Common Mistakes
Mistake 1: Forgetting Exponents
Wrong: 360 = 2 × 2 × 2 × 3 × 3 × 5 (correct but not simplified) Better: 360 = 2³ × 3² × 5 (using exponents)
Mistake 2: Stopping Too Early
Wrong: 72 = 8 × 9 (stop here) Right: 72 = 2³ × 3² (keep factoring until all are prime)
Mistake 3: Including 1 as a Prime Factor
Wrong: 12 = 1 × 2² × 3 Right: 12 = 2² × 3 (1 is not prime)
Mistake 4: Thinking Order Matters
Wrong: 12 = 3 × 2² is different from 2² × 3 Right: Order doesn't matter—it's the same factorization
Mistake 5: Missing a Prime Factor
Wrong: 84 = 2² × 7 (missing 3) Right: 84 = 2² × 3 × 7
Mistake 6: Prime Factorization of 1
Wrong: 1 = 1 (or empty product) Right: 1 has no prime factors (it's the empty product)
Fun Facts About Prime Factorization
The Largest Known Prime Factor
Factoring large numbers is extremely hard. The RSA-250 (250-digit number) was factored in 2020, taking about 2,700 core-years of computation.
Unique Factorization
The Fundamental Theorem of Arithmetic was proven by Euclid around 300 BCE.
Gaussian Integers
Prime factorization works differently for complex numbers (Gaussian integers). For example, 5 = (2 + i)(2 - i) in Gaussian integers.
Factoring Difficulty
The difficulty of factoring large numbers is the basis of RSA encryption, used to secure online transactions.
Frequently Asked Questions
What's the difference between factors and prime factors?
Factors are all numbers that divide evenly into n. Prime factors are the subset of factors that are prime numbers.
Example for 12:
- All factors: 1, 2, 3, 4, 6, 12
- Prime factors: 2, 3
Is 1 a prime factor?
No. 1 is not prime, so it's never included in prime factorization.
What's the prime factorization of 1?
By convention, 1 has no prime factors (empty product).
Can negative numbers have prime factorization?
Yes, include a factor of -1. Example: -12 = -1 × 2² × 3
What's the largest number your calculator can factor?
It works well for numbers up to ~10 million. Larger numbers may be slow.
Why do we use exponents in prime factorization?
Exponents make the representation more compact and easier to read. 2³ × 3² is clearer than 2 × 2 × 2 × 3 × 3.
How do I factor a number with a calculator?
Start dividing by 2, then 3, then 5, then 7, etc. Our calculator does this automatically!
What's a factor tree?
A visual diagram that shows how a number breaks down into factors, then prime factors.
Your Turn: Start Factoring
Prime factorization used to seem tedious to me. Now I understand it's the key to understanding the structure of numbers—their "DNA."
Here's your practice plan:
- Start with small numbers: 12, 18, 20, 24, 30
- Try perfect squares: 16, 25, 36, 49, 64, 81, 100
- Factor powers of 2: 32, 64, 128, 256, 512
- Test prime numbers: 17, 19, 23, 29, 31, 37
- Factor numbers with repeated primes: 72, 108, 144, 180, 216
- Try larger composites: 360, 420, 504, 720, 840
- Watch the steps: See how the number shrinks with each division
Ready to start? Open up our Prime Factorization Calculator and try it yourself. Start with 360, then 84, then 97.
You'll see the magic of prime factorization unfold step by step.
Have questions? Stuck on a particular factorization? Drop a comment below or reach out. I've been where you are, and I'm happy to help.
— The Solvezi Team
Disclaimer: This calculator is for educational purposes. For very large numbers (>10 million), calculations may take a few seconds.










