A prime number is an integer greater than 1 that has no positive integer divisors other than 1 and itself. The first primes are 2, 3, 5, 7, 11, 13…
Check if a number is prime, find its prime factors, and explore its properties.
A prime number is an integer greater than 1 divisible only by 1 and itself; every integer greater than 1 that is not prime is composite. To decide primality, this tool uses the Miller-Rabin test in a deterministic form, with a fixed set of 12 witnesses (2, 3, 5, …, 37) that is provably correct for any positive integer up to 10²⁴, far faster than testing divisors one by one for large numbers. For composites, it computes the full prime factorization by successive division (pulling out the factor 2, then the odd numbers up to the square root of what remains), showing the result in the form 2³ × 3² × 5. By the fundamental theorem of arithmetic, this decomposition is unique. The tool also identifies whether the number is a perfect square or a perfect cube, using exact integer roots. All the arithmetic uses BigInt (arbitrary-precision integers), with no overflow, and runs locally in your browser.
The simplest testing idea is trial division: if no integer from 2 up to √n divides n, then n is prime, you only need to go up to the root because if n = a·b, one of the factors is ≤ √n. That is great for small numbers but slow for huge ones. So the tool uses deterministic Miller-Rabin, which decides primality with a handful of modular exponentiations, and with the right witnesses gives an exact (not probabilistic) answer up to 10²⁴.
Factorization uses successive division: pull out the factor 2 while possible, then the odd numbers 3, 5, 7… up to the square root of the remaining number; whatever is left above 1 at the end is the last prime factor. The multiplicities become the output exponents. There are also two extra checks by integer roots: n is a perfect square if ⌊√n⌋² = n, and a perfect cube if ⌊∛n⌋³ = n.
Example 1, testing 97: since √97 ≈ 9.8, you only need to check the primes up to 9, namely 2, 3, 5 and 7. 97 is odd, its digit sum (16) is not divisible by 3, it does not end in 0 or 5, and 97 = 7 × 13 + 6, so 7 does not divide it either. No factor up to the root exists, so 97 is prime.
Example 2, factoring 360: pulling out 2, 360 = 2 × 2 × 2 × 45 = 2³ × 45; then 45 = 3 × 3 × 5 = 3² × 5. So 360 = 2³ × 3² × 5. Since not all exponents are even (there is a 3 and a 1), 360 is not a perfect square.
A few values escape the prime/composite split: 0 and 1 are neither, 1 is called a unit, and the definition of prime requires n > 1. 2 is the only even prime, since any other even number has 2 as a factor. An elegant consequence of unique factorization: a number is a perfect square exactly when all its prime exponents are even, and a perfect cube when they are all multiples of 3.
Primes are the raw material of number theory and the foundation of much of modern cryptography: RSA, for example, relies on the fact that multiplying two large primes is easy, but factoring the product back is computationally very hard. They also appear in hash functions, pseudorandom generators and error-correcting codes.
Paste the code into your HTML and the tool shows up on your page, without J-Kit's navigation and ads. It still runs in the browser of whoever visits your site.
<iframe
src="https://jkit.tools/embed/en-US/prime-number-checker"
width="100%"
height="600"
style="border:0"
loading="lazy"
title="Prime Number Checker"
></iframe>These references help contextualize formulas, standards, APIs and limitations used on this page. They do not replace professional validation when a result has legal, financial, medical or operational impact.
A prime number is an integer greater than 1 that has no positive integer divisors other than 1 and itself. The first primes are 2, 3, 5, 7, 11, 13…
Supports positive integers up to 10²⁴.
All calculations stay in your browser. No data is sent to any server.