How-to Guide 5 min read

How to Calculate Log Base 2 (or Any Base) on a Calculator

Find log base 2, 3, 5 or any base on a calculator with only log and ln keys, using the change-of-base formula, with worked examples and common errors.

log base 2 calculatorhow to calculate log base 2change of base formulalog2 on calculatorlog base 3 on calculator

The short answer

Most calculators only have log (base 10) and ln (base e). To get any other base, divide: log₂(x) = log(x) ÷ log(2). For example, log(1024) ÷ log(2) = 10, because 2¹⁰ = 1,024. The same trick works for base 3, 5 or any positive base other than 1. You can do it with the log, ÷ and bracket keys on the Scientific Calculator.

What log base 2 means

log₂(x) answers one question: 2 to what power gives x?

  • log₂(8) = 3, because 2 × 2 × 2 = 8.
  • log₂(1) = 0, because any positive base to the power 0 is 1.
  • log₂(0.5) = −1, because 2⁻¹ = 0.5.
  • log₂(100) is not a whole number: it is about 6.644, because 2^6.644 is about 100.

The same idea holds for any base. log₃(81) = 4 because 3⁴ = 81, and log₁₀(1,000) = 3 because 10³ = 1,000.

The change-of-base formula

log_b(x) = log(x) ÷ log(b)

The logs on the right can be in any base, as long as both use the same one. That is why it works with either calculator key:

  • With base-10 log: log₂(100) = log(100) ÷ log(2) = 2 ÷ 0.30103 ≈ 6.644
  • With natural log: log₂(100) = ln(100) ÷ ln(2) = 4.60517 ÷ 0.693147 ≈ 6.644

Both give the same answer, so use whichever key you prefer.

Why the formula works

Say log₂(100) = y. That means 2^y = 100. Take the base-10 log of both sides: log(2^y) = log(100). A power inside a log comes out as a multiplier, so y × log(2) = log(100). Divide both sides by log(2) and you get y = log(100) ÷ log(2). Nothing in those steps depends on using base 10, which is why ln works just as well.

A quick mental estimate

Before you calculate, bracket the answer with powers you know. Since 2⁶ = 64 and 2⁷ = 128, log₂(100) must be between 6 and 7, and closer to 7 because 100 is nearer 128 than 64 in ratio terms. If your calculator says 66.4 or 0.664, you know straight away that a key was missed. Useful powers of 2 to remember:

PowerValue
2⁵32
2⁸256
2¹⁰1,024
2¹⁶65,536
2²⁰1,048,576

Step by step on the Lazyblink Scientific Calculator

The calculator builds the whole expression on screen and evaluates it when you press =, so you can type the division in one go:

  • Open the Scientific Calculator.
  • Press log. The display shows log(.
  • Enter the number, for example 1024, then press ).
  • Press ÷.
  • Press log, enter the base, for example 2, then press ).
  • Press =. The display shows 10.
  • The full expression on screen is log(1024)÷log(2). To use natural logs instead, press ln in steps 2 and 5. Results are shown to 10 significant figures, and the last calculation also appears in the History list so you can compare answers.

    On a handheld calculator the key sequence is usually the same: log, number, close bracket, divide, log, base, close bracket, equals. Some newer calculators have a dedicated log-with-any-base key, but the division method works on all of them.

    Worked examples

    You wantTypeResult
    log₂(8)log(8)÷log(2)3
    log₂(1024)log(1024)÷log(2)10
    log₂(100)log(100)÷log(2)6.64385619
    log₂(1,000,000)log(1000000)÷log(2)19.93156857
    log₃(81)log(81)÷log(3)4
    log₄(256)log(256)÷log(4)4
    log₅(50)log(50)÷log(5)2.430676558
    log₂(0.125)log(0.125)÷log(2)−3

    Checking an answer

    Raise the base to your result and see whether you get the original number back. Using the xʸ key: 2, xʸ, 6.64385619, = gives about 100. If it does not, a bracket is probably missing.

    Where log base 2 is useful

    • Bits needed to count something. To label 1,000 different items in binary, you need log₂(1000) ≈ 9.97, rounded up to 10 bits.
    • Steps in a halving search. Finding one item in a sorted list of 1,000,000 by repeatedly halving takes at most about log₂(1,000,000) ≈ 19.93, so 20 steps.
    • Doubling time. Money growing at 7% a year doubles in log(2) ÷ log(1.07) ≈ 10.24 years. The popular "rule of 72" (72 ÷ 7 ≈ 10.29) is a shortcut for this same calculation.
    • How many doublings. Going from 1 million to 50 million views takes log₂(50) ≈ 5.64 doublings.

    Common mistakes

    • Leaving out the brackets. log(1024÷log(2)) is a different calculation. Close the first bracket before you divide.
    • Mixing log and ln. ln(100)÷log(2) is wrong. Top and bottom must use the same key.
    • Subtracting instead of dividing. log(x) − log(b) is log(x ÷ b), not log base b of x.
    • Taking the log of zero or a negative number. There is no real answer, so the calculator shows Error.
    • Using base 1. log(1) is 0, so dividing by it fails. Base 1 is not allowed in logarithms.

    Related calculator guides

    If you need to undo a log, read How to Find Antilog on a Calculator (Base 10 and Natural Log). Roots work in a similar way with powers, covered in How to Find a Cube Root or Any nth Root on a Calculator. To convert numbers between binary, decimal and hexadecimal directly, use the Number Base Converter.

    Frequently asked questions

    How do I calculate log base 2 on a calculator?

    Divide the base-10 log of the number by the base-10 log of 2: log₂(x) = log(x) ÷ log(2). For example, log(1024) ÷ log(2) = 10. Using ln instead of log gives the same answer.

    What is the change of base formula?

    log_b(x) = log(x) ÷ log(b), where log can be any base you like, as long as you use the same one on top and bottom. Calculators usually offer base 10 (log) and base e (ln).

    What is log base 2 of 100?

    About 6.644, because 2 raised to the power 6.644 is about 100. On a calculator: log(100) ÷ log(2) = 6.64385619.

    Why does my calculator give an error for log of 0 or a negative number?

    Logarithms are only defined for positive numbers. No power of a positive base gives 0 or a negative result, so log(0) and log(−5) have no real answer.

    Try this tool on Lazyblink

    Put this guide into practice with our free online tool — no signup required.

    Open tool