Log Base 2 Calculator

Written by:
PK

On this page is a log base 2 calculator. Enter a number to find the logarithm base 2 and we'll return the result.

Logarithm Base 2 Calculator

What is the Log Base 2?

The log base 2 is a logarithm which uses the base 2 in its calculations. Essentially, it asks "what power do I need to raise 2 to get a value x?"

Although it may appear to be an arbitrary choice, log base 2 is a natural choice for computer science and electrical engineering.

As electricity can be "on" or "off", binary values are expressed in "1" and "0" (or think "true" and "false"). Every time you add a bit to the system, you double the possible states:

\text{1 bit: }0, 1\\\text{2 bits: }00, 01, 10, 11\\\text{3 bits: }000, 001, 010, 011, 100, 101, 110, 111\\\text{etc.}

Since many elements in computers obey this constraint (RAM, hard disks, bandwidth, processor width, and so on), it's easy to talk about things as powers of two!

Logarithm Base 2 Formula

The formula for the logarithm base 2 is:

log_{2}(x)=y

Where:

  • 2: the base of the equation, 2 (raise 2 to the yth power to get x)
  • x: the argument; the number we need 2^y to equal
  • y: the power or exponent we need to find

Log Base 2 Example

Let's say you calculate you need to store something 1 MB in length in memory sold as a power of two. What's the smallest memory you could buy to store it? (Assume 1 KB = 1024 bytes.)

1\text{ MB} = 1,024\text{ KB} = 1,048,576\text{ Bytes} = 8,388,608\text{ Bits}\\log_2(8,388,608)=23\\minimum\ 2^{23}

For this case, you need a memory at least 2^23 bits wide, or 8,388,608 bits (1,048,576 bytes). This is an 8 Mbit (1 MB) memory.

(And for a moment in time, we thought no one would ever need more than 640k!)

Using the Logarithm Base 2 Calculator

Enter the argument x you want to evaluate (log base 2 of x). Results update instantly as you type.

Afterward, see the other tools and calculators.

      

PK

PK started DQYDJ in 2009 to research and discuss finance and investing and help answer financial questions. He's expanded DQYDJ to build visualizations, calculators, and interactive tools.

PK lives in New Hampshire with his wife, kids, and dog.

Don't Quit Your Day Job...

DQYDJ may be compensated by our partners if you make purchases through links. See our disclosures page. As an Amazon Associate we earn from qualifying purchases.
Sign Up For Emails
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram