Base-2 logarithms count doublings and halvings. They give the number of bits needed to store a number, the depth of a balanced binary tree, the number of steps of binary search, octaves in music and f-stops in photography.
How to use the Log Base 2 Calculator
- Number x
- Every result field is editable: type into log₂ x and Number x plus every other field update to match.
Results update as you type, and everything is calculated in your browser.
How it works
Enter x or type into the log₂ x field to go backwards.
What each result means
- log₂ x = [ln x]([Number x])÷[ln x](2)
- ln x = [ln x]([Number x])
Example values
How the main result changes when Number x changes and everything else stays at the example values above:
| Number x | log₂ x |
|---|---|
| 512 | 9 |
| 768 | 9.585 |
| 1,024 | 10 |
| 1,280 | 10.3219 |
| 1,536 | 10.585 |
| 2,048 | 11 |
Formula
log₂ x = ln x / ln 2, 2^(log₂ x) = x
Worked example
Inputs — Number x: 1,024.
Results — log₂ x = 10; Bits needed for whole numbers from 0 to x = 11; ln x = 6.931471805599.
Key terms
- Binary logarithm
- The logarithm to base 2.
Frequently asked questions
What is log₂ 1024?
10.
How many bits store the number 1000?
10 bits (up to 1023).
How many guesses does binary search need for 1,000,000 items?
About log₂ 10⁶ ≈ 20.
How many octaves between 55 Hz and 880 Hz?
log₂ 16 = 4.