Calculate logarithms for any base — log base 10, natural log (ln), log base 2, and more. Instant results with step-by-step solutions.
A logarithm answers a fundamental question: to what power must we raise a base number to get a given value? Written as logb(x) = y, it means by = x. So log10(1000) = 3 because 10³ = 1,000. Logarithms were invented in 1614 by John Napier specifically to simplify complex multiplication and division — before calculators existed, mathematicians used log tables to turn multiplication into addition.
Today, logarithms appear in virtually every quantitative field. The Richter scale for earthquakes is logarithmic — a magnitude 7.0 earthquake releases about 31.6 times more energy than a magnitude 6.0 quake, not 1.6 times more. The decibel scale for sound, pH scale for acidity, and the f-stop scale in photography are all logarithmic. In finance, logarithmic returns are used instead of simple returns because they're time-additive, making portfolio math far cleaner.
Computer scientists rely on log base 2 constantly. Binary search runs in O(log₂ n) time, meaning it takes only about 33 comparisons to find a specific value among 10 billion sorted items. The SHA-256 hash function underlying Bitcoin uses properties of logarithms. Data compression algorithms like Huffman coding and information theory are built on log base 2 measurements (bits).
| Base | Notation | Name | Primary Use | Example |
|---|---|---|---|---|
| 10 | log(x) or log₁₀(x) | Common log | Engineering, pH, decibels | log(100) = 2 |
| e ≈ 2.71828 | ln(x) | Natural log | Calculus, finance, physics | ln(e) = 1 |
| 2 | log₂(x) or lb(x) | Binary log | Computer science, information | log₂(8) = 3 |
Any logarithm can be converted to any other base using the change of base formula: logb(x) = ln(x) / ln(b) = log(x) / log(b). This is how our calculator computes logarithms for any base — it uses JavaScript's built-in natural log function and divides. For example, log7(2401) = ln(2401) / ln(7) = 7.784 / 1.946 = 4.000, since 7⁴ = 2,401.
| Property | Formula | Example |
|---|---|---|
| Product rule | log(a×b) = log(a) + log(b) | log(100×10) = log(100) + log(10) = 3 |
| Quotient rule | log(a/b) = log(a) − log(b) | log(1000/10) = 3 − 1 = 2 |
| Power rule | log(aⁿ) = n × log(a) | log(10⁵) = 5 × log(10) = 5 |
| Log of 1 | logb(1) = 0 | log(1) = 0, ln(1) = 0 |
| Log of base | logb(b) = 1 | log(10) = 1, ln(e) = 1 |
| Inverse | b^(logb(x)) = x | 10^(log 5) = 5 |
Understanding where logarithms appear in real life helps contextualize what can feel like abstract math. The Richter scale is perhaps the most famous example: each whole number increase represents roughly 31.6 times more energy released. A magnitude 9.0 earthquake (2011 Tohoku, Japan) released about 1,000 times more energy than a magnitude 7.0 quake. Scientists use log scales because otherwise the chart showing a 6.0 and a 9.0 would require the 9.0 bar to be 31,623 times taller.
In finance and investing, natural logarithms are used to calculate continuously compounded interest. The formula A = Pe^(rt) where e is Euler's number gives the exact amount after continuous compounding. A $10,000 investment at 7% continuously compounded for 30 years grows to $10,000 × e^(0.07×30) = $10,000 × e^2.1 ≈ $81,451. Log returns are also preferred in portfolio analysis because log(1.10) + log(1.20) = log(1.32), meaning you can simply add daily log returns to get the period total.
In music, the frequency ratio between two notes a semitone apart is 2^(1/12) ≈ 1.0595. An octave doubles frequency (log₂ of frequency doubles). This is why a piano's layout is logarithmic — equal physical distance on the keys represents equal ratios of frequency change, not equal absolute frequency changes.
| Expression | Value | Why It Matters |
|---|---|---|
| log(2) | 0.30103 | Used to find how many digits a power of 2 has |
| log(3) | 0.47712 | Key for base-3 conversions |
| log(π) | 0.49715 | Appears in normal distribution calculations |
| ln(2) | 0.69315 | Doubling time formula: t = ln(2)/r |
| ln(10) | 2.30259 | Converts log₁₀ to ln: multiply by 2.30259 |
| log₂(10) | 3.32193 | Bits needed to represent a decimal digit |
One of the most practical uses of logarithms in personal finance is calculating doubling time. If an investment grows at rate r per period, the number of periods to double is t = ln(2) / ln(1+r) ≈ 0.6931 / r (for small r). The Rule of 72 approximates this as 72/r%, so at 8% annual return, money doubles in approximately 9 years (more precisely: ln(2)/ln(1.08) = 9.006 years). At 12%, it doubles in about 6.1 years.