Prime Number Checker
Determine if a number is prime and factor it into primes.
Result
How it is calculated
The tool uses trial division. It tries each divisor p starting from 2 while p × p ≤ x, and every time p divides the remaining number x evenly it records p as a factor and divides it out. Whatever is left above 1 at the end is itself a prime factor.
If exactly one factor is collected, the number is prime and shows ✓, with the number itself as its only factor. Otherwise it shows ✗ and lists the prime factors with repeats, multiplied together to give the original number. Only whole numbers of 2 or more are accepted; 0, 1, negatives and numbers with a decimal part give no result, and neither do numbers of 253 (9,007,199,254,740,992) or more, which cannot be held exactly. Searching only up to the square root is enough, since a composite number always has a prime factor no larger than it.
Worked example
Check 360.
- 360 / 2 = 180, / 2 = 90, / 2 = 45: three factors of 2
- 45 / 3 = 15, / 3 = 5: two factors of 3
- 5 remains and is prime: one factor of 5
Six factors were found, so the number is not prime (✗) and the factorization is 2 × 2 × 2 × 3 × 3 × 5, which equals 2³ × 3² × 5 = 360.
Common mistakes
- Treating 1 as prime: it has only one divisor and the tool gives no result for it, as it does for 0 and negative numbers.
- Expecting a factor list for a prime: a prime shows ✓ with the number itself as the single factor.
- Assuming odd numbers are prime: 9, 15, 21 and 25 are odd and composite.
- Entering a number with a decimal part (such as 12.5) or thousands separators: only plain whole numbers are accepted, and the tool stops at 9,007,199,254,740,992 (253) with no result.
About this calculator
This tool checks whether a number is prime — meaning it has no positive divisors other than 1 and itself — by testing it against candidate divisors, and if the number is not prime, it also breaks the number down into its prime factorization, the unique set of prime numbers that multiply together to produce it. Every whole number greater than 1 is either prime or can be expressed as exactly one such product, a fact known as the fundamental theorem of arithmetic.
It is used by students learning number theory and working through factoring problems, and by programmers and hobbyists exploring topics like cryptography, where the difficulty of factoring very large numbers into their prime components underpins the security of algorithms like RSA. It also comes up in simpler practical contexts, like reducing a fraction to lowest terms or finding the least common multiple of two numbers, both of which rely on knowing prime factorizations.
Was this helpful?
You can pick up to 3 reactions.
Popular calculators
Loan Calculator
Monthly payment, total interest and full amortization schedule.
Percentage Calculator
Percent change, percent of, and ratio calculations.
Discount Calculator
Calculate final price, savings, and discount amount.
BMI Calculator
Body mass index from height and weight (metric or imperial).
Age Calculator
Compute your exact age in years, months and days from a birth date.
Compound Interest Calculator
Calculate the final amount and interest earned with compounding.
All Calculators
- Loan Calculator
- Profit Calculator
- Discount Calculator
- BMI Calculator
- Percentage Calculator
- Ideal Weight Calculator
- Age Calculator
- Pregnancy Due Date Calculator
- Compound Interest Calculator
- BMR Calculator (Basal Metabolic Rate)
- Tip Calculator
- Fuel Cost Calculator
- Date Difference Calculator
- Sleep Cycle Calculator
- Daily Water Intake Calculator
- Simple Interest Calculator
- Heart Rate Zones Calculator
- Running Pace Calculator
- Pet Age Calculator
- Calories Burned Calculator
- Macro Calculator
- TDEE Calculator (Total Daily Energy Expenditure)
- Waist-to-Hip Ratio Calculator
- Honor Roll Calculator
- One Rep Max (1RM) Calculator
- Ovulation Calculator
- Electricity Cost Calculator
- Unit Price Calculator
- Savings Goal Calculator
- Break-Even Point Calculator
- Paint Calculator
- Course Grade Average Calculator
- Business Days Calculator
- Time Duration Calculator
- Fuel Economy Calculator
- Temperature Converter
- Tile Calculator
- Aspect Ratio Calculator
- Roman Numeral Converter
- Goal Weight Timeline Calculator
- Salary Converter (Hourly to Annual)
- Credit Card Validator (Luhn)
- Body Surface Area (BSA) Calculator
- Feels-Like Temperature Calculator
- Ohm’s Law Calculator
- PPI (Pixel Density) Calculator
- Molar Mass Calculator
- Zodiac Sign Calculator (Western + Chinese)
- IBAN Validator
- Shoe Size Converter
- Country Info & Dialing Code Lookup
- Time Zone Difference (World Clock)
- CAGR (Compound Annual Growth Rate) Calculator
- Rule of 72 Calculator
- Blood Alcohol Content (BAC) Calculator
- Lean Body Mass (LBM) Calculator
- Pythagorean Theorem Calculator
- Speed Converter
- Download Time Calculator
- Date Calculator (Add/Subtract)
No calculators found
Comments (1)
The factor list is useful beyond primes: to reduce 84/126, factor both. 84 is 2 × 2 × 3 × 7 and 126 is 2 × 3 × 3 × 7, so cancel 2 × 3 × 7 = 42 and you are left with 2/3. The tool stops at 9,007,199,254,740,992 and above and shows no result there, since larger integers are no longer held exactly. Do you use it for fractions, homework or cryptography exercises?