Logarithms Explained: log₁₀, ln, log₂ and the change-of-base formula
A logarithm is the inverse of an exponent — the power b has to be raised to to give x. Here is the math, the three bases that matter (10, e, 2), the change-of-base identity, and where logs show up in everyday life from earthquakes to octaves.
What a logarithm actually is
A logarithm is the inverse of an exponent. If by = x, then logb(x) = y. The base b is whatever number is being raised to a power, and the logarithm is the power that gets b to x. That is the entire definition. The logarithm calculator on Calc Dragon evaluates logb(x) for any positive x and any positive base not equal to 1, and shows the three standard logs — log10, ln, log2 — alongside so a single value can be compared across the bases that show up in real work.
The reason logarithms are everywhere in science, finance, and engineering is that they turn multiplication into addition. The identity log(ab) = log(a) + log(b) is the whole reason slide rules worked, the reason the decibel scale is convenient, and the reason compound-interest problems can be solved for time without an iterative solver. Anything that grows or decays geometrically — bacteria, money, radioactive isotopes, the magnitude of an earthquake, the loudness of a sound — has a logarithm hiding inside it. This article walks through the math, the three bases that matter in practice, the change-of-base formula the calculator uses internally, and the places in everyday life where a logarithm answers the question "by how many zeroes" rather than "by how much".
The change-of-base formula and why it works
Most calculators — and most programming languages — only implement two logarithms natively: ln (base e) and log10. Everything else is built on top of those using the change-of-base identity:
logb(x) = ln(x) / ln(b) = log10(x) / log10(b)
The proof is one line. Start from the definition: if y = logb(x), then by = x. Take the natural log of both sides: y · ln(b) = ln(x). Divide by ln(b): y = ln(x) / ln(b). That is the formula. Any base c works in the place of e — pick whichever is convenient — and the result is the same because the ln(c) and logc(c) factors cancel out of the ratio.
The Calc Dragon logarithm calculator uses the ln version internally because JavaScript exposes Math.log as the natural log, and computing ln(x) / ln(b) gives the right answer to full double-precision for any positive base that is not 1. The base cannot be 1 because ln(1) = 0, which would put a zero in the denominator; it cannot be 0 or negative because ln of zero or negative numbers is not defined over the real numbers.
Worked example: log of 1000 in three bases
Take x = 1000 and run it through the three standard logs using the logarithm calculator:
- log10(1000): 103 = 1000, so log10(1000) = 3 exactly. The base-10 log of any whole power of ten is just the number of zeroes — log10(1) = 0, log10(10) = 1, log10(100) = 2, and so on.
- ln(1000): 1000 = e? with no clean integer answer. The calculator returns ln(1000) ≈ 6.9078. Equivalently, e6.9078 ≈ 1000.
- log2(1000): 210 = 1024, so log2(1000) is just under 10. The calculator returns log2(1000) = ln(1000) / ln(2) ≈ 6.9078 / 0.6931 ≈ 9.966. The "kilo" in "kilobyte" trades on this — 210 is close enough to 1000 that engineers used the prefix loosely for decades before IEC fixed the kibi/mebi/gibi binary prefixes in 1998.
Switch the base in the calculator to a custom value of 5 and the argument to 125 and the answer is exactly 3, because 53 = 125. The custom-base input is the one that makes the calculator useful for non-standard work — half-life calculations using base 2, magnitude scales using base 10, growth rates using base e, but also any problem where the convenient base is something else entirely (information theory in nats vs bits vs hartleys, financial doubling time at a fixed annual rate, log-log plots for arbitrary power-law fits).
The three bases that matter in practice
Base 10 — orders of magnitude
log10 answers the question "how many zeroes". A pH of 7 is ten times more acidic than a pH of 8 and a hundred times more acidic than a pH of 9. A 7.0 earthquake on the Richter scale releases about 32 times more energy than a 6.0 earthquake (the scale is 101.5per unit, not 101, because Richter measures amplitude and energy scales as amplitude raised to the 3/2 power). A signal at 3 dB is roughly twice the power of one at 0 dB; a signal at 10 dB is ten times the power. Any time a quantity ranges over many orders of magnitude — chemical concentration, sound pressure, light intensity, seismic energy — log10 is the natural way to plot it. The log calculator handles all of these directly when the base is set to 10.
Base e — continuous growth and decay
The natural log, ln, is base e ≈ 2.71828. It is the base that comes out of calculus rather than counting: the derivative of ln(x) is 1/x, the derivative of ex is ex, and any continuous growth process — compound interest in the limit, radioactive decay, cooling laws, population growth in the absence of constraints — produces an exponential with base e. The compound interest calculator uses the discrete formula A = P(1 + r/n)nt, but the continuous limit as n → ∞ collapses to A = Pert, and asking "how long until my money doubles at 5% continuously compounded" is t = ln(2) / 0.05 ≈ 13.86 years. The "rule of 72" you may have heard for estimating doubling time is just 100 · ln(2) / r ≈ 69.3 / r, rounded up to 72 because 72 has many factors and is easier to divide in your head.
Base 2 — bits, halving, and binary algorithms
log2 answers the question "how many doublings" or "how many bits". A 4-bit value can hold 24 = 16 distinct states, which means log2(16) = 4 bits is the storage cost. A binary search through a sorted list of 1 000 000 items takes about log2(1 000 000) ≈ 19.93 — call it 20 — comparisons, because each step halves the search space. A radioactive isotope with a half-life of 10 years takes log2(1000) ≈ 9.97 half-lives, or about 100 years, to drop to 0.1% of its original activity. Anywhere a process halves or doubles, base 2 is the natural unit. The logarithm calculator shows log2(x) in the breakdown row whether or not it is the primary base, so a single calculation gives all three standard readings at once.
Where logarithms show up in real life
Decibels
The decibel is 10 · log10(P / Pref) for a power ratio, or 20 · log10(V / Vref) for a voltage or pressure ratio (because power scales as voltage squared, and log of a square is twice the log). A 3 dB increase is a doubling of power; a 10 dB increase is a tenfold increase. Sound pressure levels in air use 20 µPa as the reference; electrical power uses 1 mW (dBm) or 1 W (dBW). The decibel exists because human perception of loudness, signal strength, and brightness is roughly logarithmic — equal multiplicative steps feel like equal additive ones. The Ohm's law calculator handles the underlying voltage/current/resistance arithmetic; expressing the result in dB is one log away.
pH and chemistry
pH is defined as −log10(aH+), where aH+is the activity of hydrogen ions in solution (approximately the molar concentration in dilute aqueous solutions). A pH of 0 is 1 mol/L H+; pH 7 is 10−7 mol/L; pH 14 is 10−14. The negative sign keeps everyday pH values positive even though the underlying concentration is tiny. The same negative-log convention appears in pKa, pKb, and pKw across chemistry, and in optical absorbance (A = −log10(I / I0)) in spectroscopy.
Earthquakes and seismic energy
The Richter magnitude scale is log10 of the largest seismic wave amplitude on a standard seismograph, with a distance correction. Modern seismology uses moment magnitude (Mw), defined through the seismic moment M0 as Mw = (2/3) · log10(M0) − 6.07. Both scales are logarithmic, so a magnitude 8 earthquake is not "twice" a magnitude 4 — it releases about 10(2/3)·4 ≈ 10 000 times the energy. The log scale is what lets a single number represent quakes that range from imperceptible to civilisation-altering.
Information theory
Shannon's information content of an event with probability p is −log2(p) bits. A coin flip is 1 bit (p = 1/2, −log2(1/2) = 1). A random byte is 8 bits (−log2(1/256) = 8). The entropy of a probability distribution is the expected information content, the average number of bits needed per symbol in an optimal code. Switch the log base from 2 to e and the unit becomes "nats"; switch to 10 and it becomes "hartleys" or "bans". The choice of base is just a choice of unit; the underlying quantity is the same.
Music
The musical octave is a doubling of frequency: A4 is 440 Hz, A5 is 880 Hz, A3 is 220 Hz. A semitone is the twelfth root of two ≈ 1.0595, so the equal-tempered scale has frequency ratios of 2n/12for n semitones. The cent is 1/100 of a semitone, so 1200 cents per octave, computed as 1200 · log2(f2 / f1). Pitch perception is logarithmic in frequency, which is why intervals (octaves, fifths, thirds) sound the same in any register even though the absolute frequency gap doubles each octave.
Common mistakes with logarithms
Confusing "log" with no subscript
"log" without a base is ambiguous. In secondary-school maths and on most physical calculators it means log10. In undergraduate mathematics and most physics papers it means ln (base e). In computer science it usually means log2. The same string of three letters means three different functions depending on the room. Pythonists know this — Python's math.log takes an optional base argument and defaults to ln. JavaScript's Math.log is also ln. The log calculator avoids the ambiguity by labelling every output: log10(x), ln(x), and log2(x) are always shown explicitly.
Treating log of a sum as the sum of logs
log(a + b) is not log(a) + log(b). The identity that does hold is log(ab) = log(a) + log(b), and that is the whole point of logarithms — they convert multiplication to addition, not addition to addition. The wrong identity comes up in shortcuts that look like they should work but quietly produce nonsense answers; whenever a log is being applied to a sum, factor first or use the calculator directly rather than splitting.
Forgetting that log of a number less than 1 is negative
log10(0.1) = −1, log10(0.01) = −2, log10(0.001) = −3. Any positive number less than 1 has a negative log in any base above 1. People sometimes expect the log to "wrap around" or be undefined; it does not. The function smoothly maps (0, ∞) to (−∞, ∞), with logb(1) = 0 as the crossover. Numbers below 1 produce negative logs; numbers above 1 produce positive logs; the value 1 sits at the origin.
Trying to take the log of zero or a negative number
logb(0) is undefined — the limit as x → 0 from the right is −∞, and the function does not extend to x ≤ 0 over the real numbers. Negative arguments are also undefined: there is no real number y such that 10y is negative. Complex logarithms exist (every non-zero complex number has logarithms, and there are infinitely many of them, separated by 2πi), but they are multi-valued and well outside the scope of an everyday calculator. The Calc Dragon log calculator rejects non-positive arguments with a clear message rather than returning NaN silently.
How to estimate logarithms in your head
For log10, the integer part of the answer is one less than the number of digits. log10(7) is between 0 and 1; log10(70) is between 1 and 2; log10(700) is between 2 and 3. The fractional part is harder, but a few anchor points cover most needs:
- log10(2) ≈ 0.301
- log10(3) ≈ 0.477
- log10(5) ≈ 0.699 (which is 1 − log10(2))
- log10(7) ≈ 0.845
From those four numbers and the addition rule (log(ab) = log(a) + log(b)), the log of any single-digit number factorisation is reachable. log10(6) = log10(2) + log10(3) ≈ 0.778. log10(50) = 1 + log10(5) ≈ 1.699. Slide-rule users learned these reflexively. For anything beyond a quick estimate, the log calculator gives 15 significant figures of accuracy.
When the calculator is not enough
For complex-valued logarithms, multi-valued branches, or the principal value of log of a complex number, a general-purpose logarithm calculator is the wrong tool. Computer algebra systems (Mathematica, Maple, SymPy) handle these correctly; spreadsheet LOG functions and most calculator apps do not. The Calc Dragon calculator evaluates real-valued logarithms only and returns a clear "argument must be positive" error rather than producing complex output.
For arbitrary-precision results — millions of digits of ln(2) for number-theory work — double-precision floating point is also the wrong tool. Every web calculator, including this one, runs in IEEE 754 double precision (about 15.95 decimal digits of precision). That is enough for every engineering, finance, and science use case at the scale of human work. For pi to a billion digits, or ln(2) to a million, the right tool is mpmath, MPFR, or PARI/GP running on a CPU with hours to spare.
For data analysis where the underlying quantity ranges over many orders of magnitude — population sizes, file sizes, income distributions, animal masses across species — taking log first and analysing the log-transformed data is usually the right move. A histogram of raw incomes is a spike near zero with a long invisible tail; a histogram of log incomes is roughly bell-shaped. The log-transform is the standard preprocessing step before fitting, plotting, or summarising any quantity that spans more than two orders of magnitude.
Frequently asked questions
See the FAQ on the logarithm calculator page for direct answers on the difference between log, ln, and log10; why the argument has to be positive; why the base cannot be 1; the change-of-base formula; when to use each base in real life; and how accurate the results are. The combined calculator and FAQ cover both the quick-reference questions ("what is ln(10)") and the deeper ones ("why is e the natural base"). For related math and finance tools, the compound interest calculator leans on logarithms internally to solve for time, the Ohm's law calculator pairs with decibel arithmetic in electrical work, and the distance converter handles the scientific-notation lengths that often appear alongside log-scale plots.
Frequently asked questions
What's the difference between log, ln and log₁₀?
In maths and science, "ln" always means the natural logarithm (base e ≈ 2.71828). "log" with no subscript is ambiguous — most physical calculators and engineers mean log₁₀, mathematicians often mean ln, and computer scientists often mean log₂. Python and JavaScript both implement Math.log as ln by default. The Calc Dragon log calculator labels every output explicitly to remove the ambiguity.
What is the change-of-base formula?
log_b(x) = log_c(x) / log_c(b) for any valid base c. In practice you pick c = e (so log_b(x) = ln(x)/ln(b)) or c = 10 (log_b(x) = log₁₀(x)/log₁₀(b)) because those are the bases most calculators support natively. The Calc Dragon log calculator uses the ln version internally.
Why does the argument of a logarithm have to be positive?
There is no real number y such that b^y = 0 or b^y is negative when b is positive — exponentials of real positive bases are always strictly positive. So log_b(0) and log_b(negative) are undefined over the real numbers. Complex logarithms exist (every non-zero complex number has logarithms, and there are infinitely many), but they are multi-valued and outside the scope of an everyday calculator.
Why can the base not be 1?
1 raised to any power is 1, so the equation 1^y = x has no solution unless x = 1 (in which case it has infinitely many). The change-of-base formula also breaks down: ln(1) = 0, which would put a zero in the denominator of ln(x)/ln(b). Bases of 0 or negative numbers are excluded for similar reasons.
When do I use log₁₀ vs ln vs log₂?
log₁₀ for orders of magnitude — decibels, pH, the Richter scale, anything counted by "how many zeroes". ln (natural log) for continuous growth and decay — compound interest in the limit, radioactive decay, and any calculus identity (the derivative of ln(x) is 1/x). log₂ for binary problems — bits of information, halving algorithms, doubling times.
How do I solve for time in a doubling-or-halving problem?
For a quantity growing as A = P·b^t (b > 1) or decaying as A = P·b^t (b < 1), solving for time gives t = log_b(A/P). For continuous compounding A = P·e^(rt), the time to double is t = ln(2)/r. The "rule of 72" is a common approximation: doubling time at rate r% is roughly 72/r years, which works because 100·ln(2) ≈ 69.3 and 72 is easier to divide.
What is the relationship between logarithms and decibels?
A decibel is 10·log₁₀(P/P_ref) for a power ratio, or 20·log₁₀(V/V_ref) for a voltage or pressure ratio (because power scales as voltage squared, and log of a square is twice the log). A 3 dB increase is a doubling of power; a 10 dB increase is a tenfold increase. The decibel exists because human perception of loudness, brightness, and signal strength is roughly logarithmic.
How accurate is the log calculator?
The calculator uses double-precision floating-point (≈15–16 significant decimal digits). For schoolwork, engineering, finance, and most science use cases that is effectively exact. For arbitrary-precision work — millions of digits of ln(2) for number theory — a CAS like Mathematica, Maple, or SymPy with mpmath is the right tool.
Informational only. Not personalised financial, legal, or tax advice.