Prime Number Tester

Test Whether Any Number Is Prime

Need to use Prime Number Tester right now?

Uses trial division up to the square root, computed with exact BigInt arithmetic so results stay accurate no matter how large the number.

No sign-upNo uploads 100% free
97 is a prime number

Features

  • Runs entirely in your browser
  • Privacy-first — your data is never uploaded
  • Real-time, instant results
  • 100% free, no sign-up required
  • Works on desktop, tablet, and mobile
  • No installation needed

Who uses this tool?

StudentsTeachersEngineersResearchers

About Prime Number Tester

A prime number is a whole number greater than 1 with no divisors other than 1 and itself — 2, 3, 5, 7, 11, and so on. Primes are the fundamental building blocks of number theory (every whole number greater than 1 is either prime or a product of primes) and underpin much of modern cryptography.

This tool checks whether any whole number is prime using trial division up to its square root, computed with JavaScript's BigInt type so the check remains exact even for numbers far larger than JavaScript's normal safe integer limit. If a number isn't prime, its complete prime factorization is shown as well.

Trial division works by testing whether the number is divisible by any integer from 2 up to its square root — if none divide evenly, the number is prime. Only checking up to the square root (rather than all the way up to the number itself) is a well-known optimization: if a number has a factor larger than its square root, it must also have a corresponding factor smaller than its square root, so checking further is redundant.

This is useful for number theory homework and exploration, understanding prime factorization, checking whether a specific number used in a cryptography or math context is prime, and general curiosity about a number's properties.

How it works

  1. Enter a whole number. Any non-negative integer, of any size.
  2. See whether it's prime. Checked using trial division up to the square root.
  3. View the prime factorization. Shown automatically if the number isn't prime.

Examples

Checking a prime number

Input

97

Output

97 is a prime number

Checking a composite number

Input

84

Output

84 is not a prime number — factorization: 2 × 2 × 3 × 7

Frequently asked questions