Unsupported input
The tool may reject input that does not match the expected content, structure, or file type.
Fix: Confirm the tool input requirements and paste the correct type of data.
Search tools and pages.
Check if a number is prime
sidebar • 160x600
Written by Giorgos Kostas. Last reviewed:
Prime Number Checker determines whether a positive integer is prime — divisible only by 1 and itself. For small inputs (under 10^9) it uses deterministic trial division; for larger inputs it uses the Miller–Rabin primality test with witness bases proven correct up to 3.3 × 10^14 and probabilistically correct above that.
The tool also returns the prime factorization for composite numbers, the list of primes up to a chosen limit (Sieve of Eratosthenes), and the next prime after your input — useful for cryptography exercises and number-theory homework.
Start with the prime Number input you want to process in Prime Number Checker.
Get a prime Number result from Prime Number Checker that is ready to review, copy, and reuse in the next step of your workflow.
The tool may reject input that does not match the expected content, structure, or file type.
Fix: Confirm the tool input requirements and paste the correct type of data.
Missing fields or partial content can block processing or produce weak results.
Fix: Provide the full required input before running the tool.
Sample or placeholder values can lead to output that looks valid but is not ready for real use.
Fix: Replace placeholders with your actual values before relying on the result.
For key-sized primes (1024+ bits), production cryptography libraries use Miller–Rabin with 40+ rounds, giving a false-positive rate below 2^-80. This tool uses 12 witness bases, which is deterministic up to 3.3 × 10^14 and delivers ~2^-36 false-positive above that — enough for study and verification, but you should use a proper library (OpenSSL, BoringSSL) for actual key generation.
Up to 2^64 − 1 (18,446,744,073,709,551,615). Above that, primality testing needs arbitrary-precision arithmetic (BigInt), which would slow the browser down for the test frequencies we expect. For 1024-bit or larger primes, use a CAS like WolframAlpha or a scripting environment with a GMP binding.
Trial division tries every prime up to √n as a divisor — exact but slow beyond 10^9. Miller–Rabin tests a few randomized witnesses; for n ≥ 2, if any witness 'fails', n is definitely composite. With enough witnesses, the probability of missing a composite is negligible. Miller–Rabin is how real-world primality testing is done.
Yes. The factorization output lists every prime factor and its multiplicity. For example, 360 returns 'Composite — 2³ × 3² × 5'. For very large composites with no small factors, the tool uses Pollard's rho to extract factors before handing off to Miller–Rabin on each factor.
Standard sieve with odd-only optimization: a boolean array of length n/2 is initialized, then for each prime p up to √n, all odd multiples of p are marked composite. The sieve handles an upper bound of 10,000,000 in roughly 200 ms on a modern browser — memory cost scales linearly with the bound.
By definition, a prime has exactly two distinct divisors: 1 and itself. 1 has only one divisor (itself), so it doesn't meet the definition. Excluding 1 is also the only convention that makes the Fundamental Theorem of Arithmetic — unique prime factorization — work without special cases. The tool returns 'Not prime' for 1 and 0, and 'Invalid' for negatives.
Continue the workflow with related tools for prime Number, adjacent input and output steps, or other utilities in the same category. You can also browse the full Number & Bitwise Tools category for more options.
Sort numbers in ascending or descending order
Generate random numbers
Convert Roman numerals to numbers and numbers to Roman numerals
Convert binary to hexadecimal
Convert decimal to octal
Convert hexadecimal to binary
Convert IPv6 address to binary
Convert octal to decimal
Detect a number in decimal, binary, octal, or hexadecimal form and output every other base side-by-side in one click.
Convert numbers to written words
Convert a 32-bit unsigned decimal value back into a standard dotted-quad IPv4 address.
Convert an IPv4 address into its 32-bit unsigned decimal form for routing tables, allow-lists, and database storage.
Use a single integer field and get a clear yes/no answer.
content bottom • up to 300x250