Skip to content

Big-O Complexity Calculator

See the operation count for each complexity class at your input size.

ComplexityOperationsTypical example
O(1)1Hash lookup, array index
O(log n)10Binary search, balanced tree
O(n)1.0KLinear scan
O(n log n)10.0KMerge/quick sort
O(n²)1.0MNested loops, bubble sort
O(2ⁿ)1.1e+301Naive recursion, subsets
O(n!)overflowPermutations, brute-force TSP

These are growth rates, not real runtimes — Big-O drops constant factors and lower-order terms. As a mental model, ~10⁸ simple operations take roughly a second, so green comfortably fits, amber is borderline, and red is intractable at that n. A better algorithm beats a faster machine every time the input grows.

Enter an input size n to turn abstract time complexity into concrete numbers: the calculator shows how many operations each common class — O(1), O(log n), O(n), O(n log n), O(n²), O(2ⁿ), O(n!) — performs at that size, colour-coded from comfortably fast to intractable. It makes the difference between an O(n log n) sort and an O(n²) one obvious the moment n gets large.

Big-O describes growth, not exact runtime — it deliberately drops constant factors and lower-order terms, so treat the counts as relative scale, not milliseconds. As a rule of thumb, a machine does on the order of 100 million simple operations per second, which is the band the tool uses to flag what will and will not finish quickly.

Frequently asked questions

What does Big-O notation actually measure?

It measures how an algorithm’s work grows as the input grows, ignoring constant factors and lower-order terms. O(n) means work scales linearly with input size; O(n²) means doubling the input roughly quadruples the work. It describes scalability, not the exact runtime on a specific machine.

Why does O(n log n) beat O(n²) so decisively at scale?

Because the gap widens fast. At n = 1,000,000, an O(n log n) algorithm does about 20 million operations while O(n²) does a trillion — roughly 50,000× more. That is the difference between sub-second and effectively never finishing, which is why choosing the right algorithm matters more than a faster CPU as data grows.