Next Prime Finder
Compute the smallest prime greater than N, with trial division steps and primality checks for integers up to large safe limits.
Find the next prime after N
A prime number has exactly two positive divisors: 1 and itself. Given a non-negative integer N, this tool returns the smallest prime strictly greater than N, using deterministic trial division on integers represented as BigInt for precision.
If N is already prime (for example 13), the answer is the next prime (17), not N itself, matching the usual “next prime” definition in number theory puzzles and programming exercises.
Example
After 100, the next prime is 101. After 14, the next prime is 17.
Explore Prime Number Calculator, Integer Factorization, and First N Prime Numbers.
Frequently Asked Questions
What is the largest input supported?
Inputs up to 900719925474099 (JavaScript’s MAX_SAFE_INTEGER) are accepted.
Why trial division instead of probabilistic tests?
Trial division is exact and easy to audit; a short trace shows rejected candidates for small gaps.
Is computation private?
Yes. All math runs locally in your browser.