Base-2 Math Tool

Binary Logarithm Calculator

Enter a positive binary number to calculate its base-2 logarithm. See the log₂ value, decimal equivalent, nearest powers of two, and whether the input is an exact power of 2.

Binary integers & fractions log₂ result Power-of-two check
Calculate log₂ of a Binary Number
Accepted examples: 10, 1000, 101.1, 0.01
Binary logarithm log₂(1000₂) = 3
1000₂ is exactly 2³.
Decimal Value 8
Exact Power of 2? Yes
Lower Power 2³ = 8
Upper Power 2³ = 8
Log Base 2

What Is a Binary Logarithm?

A binary logarithm is a logarithm with base 2. It answers the question: what exponent must 2 be raised to in order to produce a particular number?

Binary logarithms are written as log₂(x). For example, log₂(8) = 3 because 2³ = 8. Since decimal 8 is 1000₂, we can also write log₂(1000₂) = 3.

This Binary Logarithm Calculator accepts the input itself in base 2. It converts the numerical value as needed and calculates its base-2 logarithm.

Binary logarithm relationship log₂(x) = y ⇔ 2ʸ = x
How to Use

How to Calculate log₂ of a Binary Number

1
Enter a positive binary value Type a binary integer such as 1000 or a binary fraction such as 101.1.
2
Press Calculate The calculator evaluates the numerical value and computes its logarithm with base 2.
3
Read the log₂ result If the input is an exact power of two, the result is an exact integer. Otherwise, a decimal logarithm is displayed.
4
Check neighboring powers The result also shows the powers of two immediately below and above the input.
Exact Example

What Is log₂(1000₂)?

Binary 1000₂ equals decimal 8. Since 2 raised to the third power equals 8, its binary logarithm is exactly 3.

log₂(1000₂)
1000₂ = 8₁₀ 2³ = 8 Therefore: log₂(8) = 3 and log₂(1000₂) = 3
Non-Power Example

What Is log₂(101₂)?

Binary 101₂ equals decimal 5. Five is not an exact power of two, so its binary logarithm is not a whole number.

log₂(101₂)
101₂ = 5₁₀ 2² = 4 2³ = 8 Therefore: 2 < log₂(5) < 3 log₂(5) ≈ 2.3219280949
Reference

Common Binary Logarithm Values

Binary Input Decimal Value Binary Logarithm
1 1 0
10 2 1
100 4 2
1000 8 3
10000 16 4
100000 32 5
1000000 64 6
10000000 128 7
100000000 256 8
10000000000 1024 10
Binary Fractions

Binary Logarithms of Values Below 1

Binary logarithms can also be negative. This happens when the input is greater than zero but less than one.

For example, 0.01₂ equals one quarter. Since one quarter is 2⁻², its binary logarithm is exactly −2.

log₂(0.01₂)
0.01₂ = 0.25₁₀ 0.25 = 1 / 4 1 / 4 = 2⁻² Therefore: log₂(0.01₂) = -2
Powers of Two

Why Powers of Two Give Integer Logarithms

When the input is exactly a power of two, its base-2 logarithm is simply the exponent. This makes powers of two especially easy to recognize in binary.

Positive integer powers of two appear as a single 1 followed by zeros. For example, 100000₂ equals 32, which is 2⁵. Therefore its binary logarithm is 5.

For a positive binary integer containing exactly one 1 bit, the position of that bit determines the integer log₂ value.
Floor & Ceiling

Floor and Ceiling of a Binary Logarithm

When a number is not an exact power of two, it lies between two adjacent powers. Those boundaries are useful in many computer-science calculations.

For 101₂ = 5, the neighboring powers are 4 and 8. Therefore the logarithm lies between 2 and 3.

Binary value 101₂
2² = 4 101₂ = 5 2³ = 8 So: floor(log₂(5)) = 2 ceil(log₂(5)) = 3
Computing

Why log₂ Is Important in Computer Science

Bit Length

Base-2 logarithms help determine approximately how many binary digits are needed to represent positive integers.

Binary Search

The logarithmic complexity of binary search is commonly expressed as O(log₂ n).

Data Structures

Balanced trees and other structures frequently have heights related to the binary logarithm of their element count.

Algorithms

Repeated halving or doubling naturally produces logarithmic relationships with base 2.

Memory & Addressing

Powers of two occur throughout digital storage, address spaces, and hardware organization.

Information Theory

Base-2 logarithms are used when information is measured in bits.

Bit Length

Binary Logarithm and Number of Bits

For a positive integer n, the number of bits required for its ordinary unsigned binary representation is related directly to its base-2 logarithm.

Positive integer bit length bits = floor(log₂(n)) + 1

For example, decimal 13 is 1101₂. Since log₂(13) is between 3 and 4, its floor is 3. Adding one gives a bit length of 4, matching the four digits in 1101₂.

Limitations

Important Input Rules

The input must be positive

A real logarithm is not defined for zero or negative numbers. Therefore the binary value must be greater than zero.

Use binary digits only

The input may contain 0, 1, and one optional binary point. Decimal digits such as 2 through 9 are not valid binary digits.

Non-power results are approximate

Most positive numbers are not exact powers of two. Their logarithms are irrational or non-terminating values and are therefore displayed as decimal approximations.

FAQ

Binary Logarithm Calculator FAQs

A binary logarithm is a logarithm with base 2. log₂(x) tells you the exponent to which 2 must be raised to produce x.
1000₂ equals decimal 8. Since 2³ = 8, log₂(1000₂) equals 3.
10000₂ equals decimal 16, which is 2⁴. Therefore its binary logarithm is 4.
Yes. Positive values below 1 have negative logarithms. For example, log₂(0.01₂) = −2.
No. The logarithm of zero is not defined as a finite real number, so zero is not accepted.
Because log₂(2ⁿ) = n. The logarithm directly returns the exponent of the power of two.
101₂ equals decimal 5, so log₂(101₂) is approximately 2.3219280949.
Yes. Positive binary fractions such as 101.1, 1.01, and 0.001 are supported.
They are inverse operations. If 2ʸ = x, then log₂(x) = y.
For a positive integer n, its unsigned binary bit length is floor(log₂(n)) + 1.
It is the exponent of the largest power of two that is less than or equal to the positive value n.
No. log₂ uses base 2, while log10 uses base 10. They represent different logarithm bases and generally produce different numerical results.
Scroll to Top