Skip to main content

Prime Number Checker

Check whether an integer is prime, with smallest factor and factorisation for composites.

Written by Golam Rabbani, Founder & Lead Engineer

A prime is an integer ≥ 2 with no positive divisors other than 1 and itself.

How to use this prime number checker

  1. Enter a whole integer in the Integer field.
  2. Press Calculate to check whether the number is prime.
  3. Read the smallest factor (for composites) or confirm primality.
  4. Use Copy to put the verdict on your clipboard, or Reset to clear the input.

About this prime number checker

The prime number checker tests whether an integer is prime by trial division up to its square root. A prime is an integer greater than or equal to 2 whose only positive divisors are 1 and itself; everything else is composite.

The method is fast because it only checks potential divisors up to ⌊√n⌋. Any factor larger than that would pair with a smaller factor, which would already have been found. The checker explicitly tests 2 and 3, then walks through values of the form 6k − 1 and 6k + 1, which is a standard speed-up that skips multiples of 2 and 3. For example, to test n = 97: ⌊√97⌋ = 9, so the tool checks 2, 3, 5, 7. None divide 97 exactly, so 97 is prime. For composites such as n = 91, the tool finds 7 as a factor (91 ÷ 7 = 13), so 91 is reported as not prime with prime factorisation 7 × 13.

Primality testing is the foundation of cryptography (RSA), random-number generation, and many number-theory problems.

FAQ

What does the prime number checker do?
It tests whether an integer is prime — meaning ≥ 2 and divisible only by 1 and itself. Composites also receive a smallest-factor report and, for smaller inputs, a full prime factorisation.
What method does it use?
Trial division up to ⌊√n⌋. It first checks 2 and 3, then walks values of the form 6k ± 1 to skip multiples of 2 and 3. This is fast enough for any integer up to about 10^12 in the browser.
Is 1 a prime number?
No. Modern convention defines a prime as an integer ≥ 2, so 1 (and any smaller integer) is not prime. The tool returns "not prime" for 1, 0, and negatives.
How large a number can I test?
Up to 1,000,000,000,000 (one trillion). Above that the trial-division method becomes slow in the browser; deterministic primality testing of very large integers needs probabilistic algorithms.
Does this tool store my numbers?
No. The calculation runs entirely in your browser; nothing is sent to a server or saved between visits.
Is the prime number checker free?
Yes. It is free to use with no signup, no account, and no usage limit.