Logarithm Calculator — Calculate Log Base n
Free online logarithm calculator. Compute log base 2, base 10, base e, or any custom base with step-by-step explanations.
Try the free calculator
Put these formulas into practice with our instant, step-by-step Logarithm Calculator.
TL;DR
A logarithm answers: "to what power must a base be raised to produce a given value?" The three most common bases are base 10 (common log), base e ≈ 2.718 (natural log, ln), and base 2 (binary log). Use the change of base formula: log_b(x) = ln(x) / ln(b) to convert between any bases. Logarithms are essential in science, finance, computer science, and engineering.
Free — no sign-up required
A logarithm answers the question: to what power must a base number be raised to produce a given value? In other words, if b raised to the power of x equals y, then the logarithm of y with base b is x. A logarithm calculator computes this relationship for any base, whether the common base 10, the natural base e, or a completely custom value you specify. Understanding logarithms is essential for working with exponential growth, scientific measurements, financial models, and algorithmic complexity.
What Is a Logarithm?
A logarithm is the inverse operation of exponentiation. Just as division reverses multiplication, logarithms reverse the process of raising a number to a power. If 2³ = 8, then log₂(8) = 3. The logarithm tells you the exponent needed to produce a given result from a specific base.
Logarithms are defined only for positive numbers. You cannot take the logarithm of zero or a negative number in the real number system because no real exponent of a positive base can produce zero or a negative result. The logarithm of 1 is always 0 regardless of the base, because any number raised to the power of 0 equals 1.
Quick Definition
The logarithm of y with base b, written as log_b(y), is the exponent x such that b^x = y. For example, log₂(8) = 3 because 2³ = 8. Logarithms convert multiplication into addition, making them powerful tools for simplifying complex calculations.
Understanding Logarithm Bases
The base of a logarithm determines the scaling system used. Three bases are used most frequently in mathematics, science, and engineering:
- Common Logarithm (base 10): Written as log(x) or log₁₀(x). Widely used in scientific calculations, the Richter scale (earthquake magnitude), and pH (acidity). A value of log(100) = 2 because 10² = 100.
- Natural Logarithm (base e ≈ 2.71828): Written as ln(x). Appears in calculus, compound interest models, radioactive decay, and growth equations. ln(e) = 1 because e¹ = e.
- Binary Logarithm (base 2): Written as log₂(x). Fundamental in computer science for analyzing algorithm complexity (binary search, merge sort) and data structures (binary trees, hash tables). log₂(8) = 3 because 2³ = 8.
| Base | Notation | Primary Use | Example |
|---|---|---|---|
| 10 | log(x) | Science, pH, decibels | log(1000) = 3 |
| e (2.718) | ln(x) | Calculus, finance, growth | ln(7.389) ≈ 2 |
| 2 | log₂(x) | Computer science | log₂(32) = 5 |
Properties of Logarithms
Logarithms follow several important algebraic rules that simplify complex expressions and make solving equations easier:
Product Rule
log_b(M × N) = log_b(M) + log_b(N)
The log of a product equals the sum of the logs.
Quotient Rule
log_b(M / N) = log_b(M) − log_b(N)
The log of a division equals the difference of the logs.
Power Rule
log_b(M^k) = k × log_b(M)
An exponent inside the log can be moved in front as a multiplier.
Identity Rule
log_b(b) = 1 and log_b(1) = 0
Any base raised to 1 equals itself; any base raised to 0 equals 1.
These properties make logarithms indispensable for solving equations involving exponential growth, such as population models, radioactive decay, and sound intensity measured in decibels.
The Change of Base Formula
When you need a logarithm with a base that is not one of the standard choices, the change of base formula becomes essential. The formula states:
This relationship allows any logarithm calculator to compute values for arbitrary bases using only natural or common logarithms internally. For example, to calculate log₅(25), you would compute ln(25) / ln(5) = 3.2189 / 1.6094 = 2.0, which is correct since 5² = 25.
Worked Examples
Example 1: log₂(64)
2 raised to what power equals 64? Since 2⁶ = 64, log₂(64) = 6.
Example 2: log₁₀(1000)
10 raised to what power equals 1000? Since 10³ = 1000, log₁₀(1000) = 3.
Example 3: ln(20.086)
e raised to what power equals 20.086? Since e³ ≈ 20.086, ln(20.086) ≈ 3.
Example 4: log₃(81) using change of base
Using change of base: ln(81) / ln(3) = 4.3944 / 1.0986 = 4. Verify: 3⁴ = 81. ✓
Logarithmic Scales in the Real World
Many natural phenomena span enormous ranges of values, making linear scales impractical. Logarithmic scales compress these ranges by measuring orders of magnitude rather than absolute differences. This is why the Richter scale uses base-10 logarithms: a magnitude 7 earthquake is not 7 times stronger than a magnitude 1 — it is 10⁶ (one million) times stronger.
The decibel scale for sound intensity, the pH scale for acidity, and the stellar magnitude scale for star brightness all use logarithmic measurements. In each case, a small change in the logarithmic value represents a large change in the underlying quantity. Understanding logarithms helps you interpret these scales correctly and make informed decisions based on logarithmic data.
Logarithms in Finance
In finance, logarithmic returns (also called continuously compounded returns) are used to analyze stock price movements because they are time-additive. If a stock returns 5% in month 1 and 3% in month 2, the simple total is not 8% — the logarithmic approach accounts for compounding by using ln(P₂/P₁) for each period.
The Black-Scholes model for option pricing, one of the most important equations in financial mathematics, relies heavily on natural logarithms. Compound interest formulas also use ln to convert between different compounding frequencies. Understanding logarithms gives investors and analysts a more accurate framework for evaluating returns and risk.
Logarithms in Computer Science
Logarithmic time complexity, denoted as O(log n), describes highly efficient algorithms like binary search, where each step halves the remaining search space. A sorted list of 1,024 items can be searched in at most 10 comparisons (since log₂(1024) = 10), compared to 1,024 comparisons for a linear search.
Binary logarithms are also fundamental to data structure design. Binary trees store data in a hierarchical structure where the height is log₂(n), enabling O(log n) search, insertion, and deletion. Hash table sizing uses power-of-two capacities based on log₂ calculations. Network bandwidth analysis uses log₂ to determine how many bits are needed to represent a given number of states.
Frequently Asked Questions
What is the difference between log and ln?
log (without a base specified) typically means log₁₀ (common logarithm), while ln means log_e (natural logarithm). log₁₀ uses base 10 and is common in science; ln uses base e ≈ 2.718 and appears in calculus and finance.
Can you take the logarithm of a negative number?
No, logarithms of negative numbers are undefined in the real number system. No real exponent of a positive base can produce a negative result. In complex mathematics, logarithms of negative numbers produce complex (imaginary) results.
What is the change of base formula?
The change of base formula is log_b(x) = ln(x) / ln(b). It allows you to compute a logarithm with any base using only natural (or common) logarithms. This is how most calculators handle non-standard bases.
Why is log₁₀(100) = 2?
Because 10 raised to the power of 2 equals 100. The logarithm answers the question: "10 to what power gives 100?" The answer is 2.
What are logarithms used for in real life?
Logarithms appear in the Richter scale (earthquakes), pH scale (acidity), decibels (sound), compound interest (finance), algorithm analysis (computer science), and many scientific measurements that span large ranges.
How do I calculate log base 2 without a special calculator?
Use the change of base formula: log₂(x) = ln(x) / ln(2). For example, log₂(32) = ln(32) / ln(2) = 3.4657 / 0.6931 = 5.
What is a logarithmic scale?
A logarithmic scale compresses large ranges by measuring orders of magnitude. Each unit increase represents a 10× (or 2×) multiplication of the underlying value. Used in seismology, acoustics, chemistry, and astronomy.
What is the relationship between exponents and logarithms?
They are inverse operations. If b^x = y, then log_b(y) = x. Exponentiation raises a base to a power; logarithms find the power needed to produce a result.