Connect via MCP →

Enter Calculation

Formula

Advertisement

Results

log2(8)
3
log base 2 of x
Natural log (ln x) 2.079442
Common log (log₁₀ x) 0.90309

What is a log base 2?

The base-2 logarithm of a number x answers the question: "to what power must 2 be raised to get x?" For example, \(\log_{2}(8) = 3\) because \(2^3 = 8\). Base-2 logarithms are central to computer science, information theory, and digital systems, where data is measured in bits and powers of two.

Graph of the log base 2 curve passing through key points
The log₂ curve rises slowly, crossing the x-axis at x = 1 and passing through (2, 1), (4, 2) and (8, 3).

How to use this calculator

Enter any positive number x in the input field and the calculator instantly returns \(\log_{2}(x)\). It also shows the natural logarithm (\(\ln x\)) and common logarithm (\(\log_{10} x\)) for convenient comparison. Only positive numbers have real logarithms, so x must be greater than zero.

The formula explained

Most calculators and programming languages provide the natural log (ln) and common log (log₁₀) but not log base 2 directly. The change-of-base formula solves this:

$$\log_{2}\left(\text{Number}\right) = \frac{\ln\left(\text{Number}\right)}{\ln(2)}$$

Since \(\ln(2) \approx 0.6931472\), dividing the natural log of x by this constant converts it to base 2. The same trick works with log₁₀: \(\log_{2}(x) = \frac{\log_{10}(x)}{\log_{10}(2)}\).

Change of base formula shown as a fraction of two natural logarithms
log₂(x) is computed by dividing ln(x) by ln(2).

Worked example

Find \(\log_{2}(10)\). First take the natural log: \(\ln(10) \approx 2.302585\). Then divide by \(\ln(2) \approx 0.693147\). The result is $$\frac{2.302585}{0.693147} \approx 3.321928.$$ So \(2^{3.321928} \approx 10\), which checks out.

FAQ

Why must x be positive? Logarithms of zero or negative numbers are undefined in the real number system, so the calculator requires \(x > 0\).

What is \(\log_{2}(1)\)? It equals 0, because any base raised to the power 0 is 1.

Where is log base 2 used? It appears in computing storage sizes, algorithm complexity (e.g. binary search runs in \(O(\log_{2} n)\) time), entropy in information theory, and music interval calculations.

Last updated: