Utinzo

Prime Number Checker

Check if a number is prime and find all prime factors. Also lists the nearest primes above and below.

Did this tool work for you?

How to use this calculator

A number n is prime if it has no divisors other than 1 and itself

Check divisibility up to √n. If no factor is found, the number is prime.

  1. 1

    Enter any positive integer.

  2. 2

    The calculator checks if it is prime.

  3. 3

    For composite numbers, it shows the full prime factorization.

  4. 4

    It also shows the nearest primes above and below your number.

Frequently asked questions

Is 1 prime? What about 0 and negative numbers?

No. A prime has exactly two distinct positive divisors, and 1 has only one, so 1 is not prime; neither is 0. The smallest prime is 2. If you enter a negative number such as −13, the checker works on its absolute value and reports on 13, so read the heading of the result to see which number was actually tested.

Why is 2 the only even prime?

Every other even number is divisible by 2 as well as by 1 and itself, which gives it at least three divisors. For 2 the checker shows the previous prime as N/A because there is no prime below it, and the next prime as 3.

How large a number can I enter?

Up to 10,000,000,000,000 (10¹³). The method is trial division up to the square root, which finishes almost instantly for numbers of this size. Larger inputs are rejected rather than risk imprecise arithmetic, since JavaScript numbers lose exactness above about 9 × 10¹⁵. Cryptographic-size primes need different algorithms.

Why does a decimal give an error?

Primality only applies to whole numbers, so 3.5 or 97.2 is rejected instead of being silently rounded to something you did not enter. The same goes for non-numeric input.

How are the prime factors written?

Smallest to largest, repeated as many times as they divide the number, joined by ×. For 1024 you see 2 × 2 × 2 × 2 × 2 × 2 × 2 × 2 × 2 × 2 (ten 2s, since 1024 = 2¹⁰), and for 100 you see 2 × 2 × 5 × 5. The tool does not collapse repeats into exponent notation.

What do “Previous Prime” and “Next Prime” mean when I enter a prime?

They are the closest primes strictly below and strictly above the number, never the number itself. For 97 they are 89 and 101. For 999,999,937, the largest prime below one billion, the next prime shown is 1,000,000,007.

Does it test for pseudoprimes or use probabilistic tests?

No. It does exhaustive trial division, so every answer is exact within the allowed range, including numbers such as 561 = 3 × 11 × 17 that fool the simple Fermat test. It also does not list all primes in a range or generate the sieve of Eratosthenes.

About prime number checker

Prime number checker with factorization

What the checker reports

Enter a whole number and you get four lines: whether it is prime, its prime factorization, the nearest prime below, and the nearest prime above. Primality is decided by trying divisors up to the square root of the number, because if n has a factor larger than √n, it must also have a partner smaller than √n. That keeps even a number near ten trillion to a few million divisions at most.

Sample results (run through the checker)
InputPrime?FactorsPrevious / next prime
97Yes9789 / 101
91No7 × 1389 / 97
143No11 × 13139 / 149
561No3 × 11 × 17557 / 563
7919Yes79197907 / 7927
2147483647Yes21474836472147483629 / 2147483659

Worked example: numbers that only look prime

Both 91 and 143 pass a quick glance because they are odd and not divisible by 3 or 5. The checker shows 91 = 7 × 13 and 143 = 11 × 13, and 561 turns out to be 3 × 11 × 17. A useful habit is to try every prime up to the square root by hand: for 143 that means 2, 3, 5, 7 and 11, and 11 divides it. The same trick explains why 221 = 13 × 17 is not prime although 221 is not divisible by anything below 13.

Worked example: a large prime and its neighbours

2,147,483,647 is the largest signed 32-bit integer and also prime, so the checker lists it as its own sole factor, with 2,147,483,629 as the nearest prime below and 2,147,483,659 as the nearest above. Gaps between neighbouring primes are irregular: 7919 sits 12 above 7907, but 7927 is 8 above it. For a composite like 600,851,475,143 the output reads 71 × 839 × 1471 × 6857.

Using factorizations

Prime factors let you reduce fractions, find greatest common divisors and least common multiples, and see whether a number is a perfect square (every prime appears an even number of times). 100 = 2 × 2 × 5 × 5 is a square, 1024 with ten 2s is also a square, while 91 is not. To get a GCD, factor both numbers and multiply the primes they share.

Scope

Inputs must be whole numbers up to 10¹³ in absolute value. Entries below 2 are reported as not prime, and negatives are tested by their absolute value. The tool performs exact trial division, with no probabilistic shortcuts, and it does not enumerate primes over a range.

Prime Number Checker – Utinzo

Learn more from an authoritative source:

Wikipedia
Related tools

Results are estimates for informational purposes only and do not constitute professional financial, medical, legal, or technical advice. Read full disclaimer →