Log Base 2 Calculator
Welcome to Omni's log base 2 calculator. Your favorite tool to calculate the value of log₂(x) for arbitrary (positive) x. The operation is a special case of the logarithm, i.e. when the log's base is equal to 2. As such, we sometimes call it the binary logarithm. If you wish to discover the more general case, check out our log calculator.
So what is, e.g., the log with base 2 of 8? Or log₂ 16? Or log₂ 32? Well, let's jump straight into the article and find out!
What is a logarithm?
As soon as humanity learned to add numbers, it found a way to simplify the notation for adding the same number several times: multiplication.
5 + 5 + 5 + 5 + 5 + 5 + 5 + 5 = 8 × 5
Then, an obvious question appeared: how could we write multiplying the same number several times? And again, there came some smart mathematicians who introduced exponents.
5 × 5 × 5 × 5 × 5 × 5 × 5 × 5 = 5⁸
However, there is always that one curious person who asks the wildest questions. In this case, they wondered if there was a way to invert all these operations. Lucky for us, mathematics, and the whole world of science, other curious people found the answer.
For addition, it was easy: the inverse operation is subtraction. For multiplication, it's still pretty simple: it's division. For exponents, however, the story gets more complicated. After all, we know that 5 + 8 = 8 + 5 and 5 × 8 = 8 × 5, but 5⁸ is very different from 8⁵. So what should the inverse operation give? If we have 5⁸, should it return 5 or 8?
The logarithm (of base 5) would be the operation if we chose option 8. In other words, it is a function that tells you the exponent needed to obtain the value. Symbolically, we can write the definition like so:
💡 logₐ(b) gives you the power to which you'd need to raise a in order to obtain b. Note, however, that, in general, this can be a fractional exponent!
For comparison, the inverse operation that would return the 5 from 5⁸ would be simply the (8-th) root. If we wanted to get a bit more technical, then we could say that, in general, if we had an expression xʸ, then the root is the inverse operation for x, while the logarithm is that for y. And if we wanted to get even more technical, we'd say that the first inverts a polynomial function, while the latter inverts an exponential one.
Before we move further, let us have a pretty bullet list with a few vital points of information about our new friend, the logarithm function.
-
There are two very special cases of the logarithm which have unique notation: the natural logarithm and the logarithm with base 10. We denote them ln(x) and log(x) (the second one simply without the small 10), and their bases are, respectively, the Euler number e and (surprise, surprise!) the number 10.
While the latter is obvious, the former may pose some problems – if you're not sure what the number e is, check out our e calculator.
-
The logarithm function is defined only for positive numbers. In other words, whenever we write logₐ(b), we require b to be positive.
-
Whatever the base, the logarithm of 1 is equal to 0. After all, whatever we raise to power 0, we get 1.
-
Logarithms are extremely important. And we mean EXTREMELY important. Outside of mathematics, they're used in statistics (e.g., the lognormal distribution), economy (e.g., the GDP index), medicine (e.g., the QUICKI index), and chemistry (e.g., the half-life decay). Also, quite a few physical units are based on logarithms, for instance, the Richter scale, the pH scale, and the dB scale.
Today, we'll focus on a very special case of the logarithm, i.e., base 2, which we sometimes call the binary logarithm. In essence, we'll focus on taking the powers of 2 and… Well, on second thought, why don't we dedicate a whole section to this one?
Binary logarithm
As mentioned at the end of the above section, the binary logarithm is a special case of the logarithmic function with base 2. That means that we'll have expressions of the form log₂(x), and we'll ask ourselves to what power we should raise 2 in order to obtain x. For instance, we can easily observe that log₂ 4 = 2.
Seemingly, 2 is a number like any other. However, it has some interesting properties. E.g., it is the smallest prime number and the only even one. Moreover, it's the base for any computer-related operations via the binary representation.
Since it's so important, let's recall a few basic powers of 2. Remember that the exponent can also be 0 or even negative.
x | -3 | -2 | -1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2x | ⅛ | ¼ | ½ | 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 | 256 |
Now we can see some more examples than just the log₂ 4 = 2 from above. For instance, we can say that the log with base 2 of 8 is 3. Similarly, log₂ 16 = 4 or log₂ 32 = 5.
But what is, say, log₂ 5? Surely, 5 is not a power of 2.
To be precise, it's not an integer power of 2. We have to remember that there are also fractional exponents, and indeed, here, we need one of those. Unfortunately, they're not so simple to guess. In some cases, we can try to use tricks like the change of base rule, but, in general, it's best to use an external tool – something like our log base 2 calculator or the change of base formula calculator.
In it, you can see two variable windows: x and log₂(x). Hopefully, the notation is self-explanatory. For example, if you'd like to find log₂ 16, you need to input 16 under x, and the calculator will give you the answer in the other window. If you require log₂ 32, you enter 32. Also, note how Omni's log base 2 calculator works both ways: you can either input the value of x and obtain log₂(x) or the other way round.
That'll be enough for today's lesson. Go, my young padawan, and make sure to play around with the calculator or any other algebra-related tool that we have on offer.
How do I calculate the logarithm in base 2?
To calculate the logarithm in base 2, you probably need a calculator. However, if you know the result of the natural logarithm or the base 10 logarithm of the same argument, you can follow these easy steps to find the result. For a number x
:
-
Find the result of either
log10(x)
orln(x)
. -
Divide the result of the previous step by the corresponding value between:
-
log10(2) = 0.30103
; or -
ln(2) = 0.693147
.
-
-
The result of the division is
log2(x)
.
What is the logarithm in base 2 of 256?
The logarithm in base 2 of 256 is 8. To find this result, consider the following formula:
2x = 256
The logarithm corresponds to the following equation:
log2(256) = x
In this case, we can check the powers of 2 to see if we can find the value of x: 20 = 1, 21 = 2, 22 = 4, …, 27 = 128, and 28 = 256.
Since we found the argument of our logarithm, we can write that:
log2(256) = 8.
Why is the logarithm in base 2 important?
In a computer world, binary code is of essential importance: words, numbers, pictures, and everything else can be reduced to a string of 0s and 1s. Since the binary code uses only two digits, the number 2 appears consistently in computer science.
The widespread appearance of log2 in computer science has no strong mathematical reason (since logarithms can change base by multiplication) but can be useful. For example, using log2 to compute entropy allows us to obtain the result expressed in bits, which are the natural unit.
What is the difference between ln and log2?
The difference between ln and log2 is the base. The logarithm is the inverse operation of exponentiation, that is, the power of a number, and it answers the question: "what is the exponent that produces a given result?".
The base of the logarithm is the number to which you apply the exponent: in the case of ln, the number is e, Neper's number. For log2, you must consider the number 2. To sum up:
- If b = ln(x), then eb = x; and
- If c = log2(x), then 2c = x.