Skip to content
1001 Tools
sr
Math & education

Prime Number Checker

Enter a whole number to find out if it’s prime — divisible only by 1 and itself. If it isn’t, you get its prime factorisation and smallest divisor; either way you get the next and previous prime. Useful for homework, cryptography curiosity and number puzzles. It runs on your device.

Enter a whole number to test it.

How it works

The tool tests divisibility efficiently: after ruling out 2 and 3, it only checks divisors of the form 6k±1 up to the square root of the number, which is why even large values resolve instantly. A number is prime if none of those divides it evenly.

For composite numbers it also computes the prime factorisation — the unique set of primes whose product is your number — shown with exponents, like 360 = 2³ × 3² × 5. It supports whole numbers up to about a quadrillion; beyond that, trial division would stop feeling instant.

Practical examples

A prime

17 is prime: nothing between 2 and its square root divides it. The tool shows the nearest primes, 13 before and 19 after.

A composite with repeated factors

360 factorises as 2³ × 3² × 5. Reading the exponents tells you at a glance how many times each prime divides it.

A tricky-looking number

561 looks like it might be prime but is 3 × 11 × 17 — a classic “Carmichael number” that fools simple tests. Exact trial division catches it correctly.

Frequently asked questions

What makes a number prime?

A prime is a whole number greater than 1 with exactly two divisors: 1 and itself. 2, 3, 5, 7, 11 and so on. Numbers with more divisors are “composite”, and 1 is neither prime nor composite by definition.

Is 1 a prime number?

No. A prime must have exactly two distinct divisors, and 1 has only one (itself). Excluding 1 keeps the fundamental theorem of arithmetic — that every number factors into primes uniquely — clean.

Is 2 really prime?

Yes, and it’s the only even prime. Every other even number is divisible by 2, so 2 is the sole even prime — a fact worth remembering for puzzles and proofs.

What is prime factorisation?

Breaking a number into the primes that multiply to make it, such as 84 = 2² × 3 × 7. Every whole number above 1 has exactly one prime factorisation, which is why it underpins fractions, GCD/LCM and cryptography.

How large a number can it handle?

Up to about 10¹⁵ (a quadrillion). The method is exact trial division up to the square root, which stays fast in that range. Much larger numbers need specialised algorithms beyond this tool’s scope.

Why does it also show the nearest primes?

Knowing the prime just below and just above your number is handy for choosing table sizes, understanding prime gaps, or simply exploring. When your number is prime, those neighbours frame it.

Does it handle 0 and negative numbers?

It treats 0 and 1 as not prime and shows no factors for them. The input accepts whole numbers only; primality is defined for integers greater than 1, so negatives aren’t part of the check.

Is my number sent anywhere?

No. The check runs entirely in your browser; nothing is uploaded and analytics never receives the number.

Related tools