CalcCafe

Logarithm Calculator

Compute the logarithm of any positive number in any base, plus its natural log and log base 2.

logb(x)
3
log₁₀ (x)
-
ln (x)
-
log₂ (x)
-

Defined only for x > 0 and base b > 0, b ≠ 1. Results are rounded for display.

Example

To find log base 2 of 8, enter value 8 and base 2:

log_b(x) = ln(x) / ln(b)
log_2(8) = ln(8) / ln(2)
     = 2.0794 / 0.6931
     = 3

Because 2³ = 8, the answer is exactly 3. With base 10, log₁₀(1000) = 3 since 10³ = 1000.

How it works

Enter a value and a base; the result uses the change-of-base formula log_b(x) = ln(x) / ln(b). Natural log (base e) and log base 2 are shown alongside.

Good to know

This Logarithm Calculator answers a single question: to what power must a base be raised to produce a given number? You type a positive value (x) and a base (b), and it returns logb(x) along with three fixed reference results — the common log (base 10), the natural log (base e, written ln), and log base 2. It's aimed at students working through algebra or precalculus, anyone checking homework, and people in fields like computing, acoustics, chemistry, or finance where logs show up in pH, decibels, entropy, or compound-growth math.

Reach for it whenever you need a quick log without hunting for the right button on a physical calculator, or when you want a base that most calculators don't offer directly. Because all three standard logs appear at once, it's also handy for converting between them or sanity-checking which base a textbook or formula actually means when it just writes "log".

To read the result, treat it as an exponent: log2(8) = 3 means 2 raised to the 3rd power equals 8. A whole-number answer signals that x is an exact power of the base; a decimal means it falls between two powers (for example, log10 of 500 sits between 2 and 3 because 500 is between 100 and 1000). Larger inputs grow the log slowly — multiplying x by 10 only adds 1 to its base-10 log.

One practical caveat: the calculator is defined only for x > 0 and base b > 0 with b not equal to 1, so any zero, negative, or base-1 entry shows a dash rather than an error. Displayed figures are rounded, so a result reading 3 may technically be 2.9999999999 from floating-point math; if you need an exact symbolic value, confirm it by raising the base to the rounded power and checking you get x back.

Frequently asked questions

Why can't I take the log of a negative number or zero?
Logarithms are only defined for positive values, because no real exponent of a positive base produces zero or a negative result. For x ≤ 0 the calculator shows a dash instead of an error.
What base does this calculator use by default?
The base field defaults to 10 (common logarithm), so log_b(x) shows log₁₀ unless you change it. The natural log (base e) and log base 2 are always shown in the stats regardless of the base you pick.
Is my data uploaded anywhere?
No — this calculator runs entirely in your browser; nothing is uploaded.
Is it free?
Yes, completely free with no sign-up and no limits.

People also ask

What is the difference between log and ln?
"Log" usually means the common logarithm with base 10, while "ln" is the natural logarithm with base e (about 2.71828). They measure the same kind of relationship but against different bases, and you can convert between them by dividing by ln(10).
How do you calculate a logarithm by hand?
For exact powers you can reason it out — log base 2 of 8 is 3 because 2 to the 3rd power is 8. For arbitrary numbers there is no simple hand method, so people use the change-of-base formula log_b(x) = ln(x)/ln(b) with a calculator or log tables.
What is the change-of-base formula?
The change-of-base formula lets you compute a log in any base using logs you already have: log_b(x) = log(x)/log(b), or equivalently ln(x)/ln(b). This calculator uses it internally so it can handle any valid base you enter.
What is log base 2 used for?
Log base 2 is common in computing and information theory because data and memory scale in powers of two. It tells you roughly how many bits are needed to represent a number, or how many times you can halve a quantity before reaching 1.
Why is the logarithm of 1 always zero?
Any positive base raised to the power 0 equals 1, so log_b(1) = 0 for every valid base. That is why this calculator returns 0 across all bases when you enter a value of 1.
Can a logarithm be negative?
Yes. The log of a number between 0 and 1 is negative, because the base must be raised to a negative exponent to produce a fraction. For example, log base 10 of 0.01 is -2 since 10 to the power -2 equals 0.01.
What does it mean when a logarithm has a decimal value?
A decimal result means the input is not an exact power of the base and falls between two whole-number powers. For instance, log base 10 of 50 is about 1.7, placing 50 between 10 (log 1) and 100 (log 2).

Related calculators