🔢 Prime Factorization
Decompose an integer into its prime factors with exponents. For example, 12 = 2² × 3. Uses BigInt for large inputs.
Factor an integer
About the Prime Factorization Tool
This tool runs entirely in your browser. Enter any integer greater than 1 and it returns the unique product of prime powers that equals your input. The algorithm uses trial division by 2 then by odd numbers up to the square root, with BigInt arithmetic so large inputs stay exact.
The fundamental theorem of arithmetic
- Unique decomposition — Every integer n > 1 can be written as a product of primes in exactly one way (up to ordering). For example,
360 = 2³ × 3² × 5. - Exponent notation — Repeated factors are written with exponents:
12 = 2² × 3, not 2 × 2 × 3. - Trial division — Divide n by 2 as many times as possible, then by 3, 5, 7, … Each time the remainder is 0, record that prime and continue with the quotient. Stop when the divisor exceeds √(remaining).
- Why √n is enough — If a composite remainder r had two prime factors both larger than √r, their product would exceed r — impossible. So once the divisor passes √r, the remainder itself must be prime (or 1).
How to use the tool
- Type an integer ≥ 2 into the input field.
- Click Factor to see the prime factorization.
- The compact form (with exponents) appears in bold; the full list of prime factors is shown below.
Frequently asked questions
What happens for 0 or 1? These have no prime factorization (0 is divisible by every prime; 1 is the empty product by convention). The tool asks you to enter a number ≥ 2.
What if I enter a prime number? The result is the number itself, with exponent 1.
How large can the input be? BigInt keeps the value exact, but trial division slows down as √n grows. Numbers with small prime factors factor instantly even if large; a product of two large primes can take much longer.
Is my input stored or uploaded? No. Everything happens in your browser. Your numbers are never sent to a server.