
What a Logarithm Actually Is
A logarithm of a number is the exponent you raise a chosen base to in order to produce that number, written as log_b(x) = y when b^y = x. To calculate it you solve a simple equation: if you know the base and the result you want, the logarithm tells you which power of the base gets you there. The three bases that come up most often are 10 (the common log), e ≈ 2.71828 (the natural log, written ln), and 2 (the binary log). Any other base — 5, 7, 42 — is converted to those using the change of base formula log_b(x) = ln(x) ÷ ln(b), so a calculator that knows ln can return every base. Inputs are restricted: the argument x must be greater than 0, and the base must be greater than 0 and not equal to 1, because no real power of a positive base ever produces 0 or a negative number.
The word "logarithm" comes from a Greek-Latin mashup meaning "ratio number," which is a hint at what the operation really is: a count of how many times one number has to multiply itself to reach another. In the expression log_b(x) = y, b is the base, x is the argument (the number you start with), and y is the answer — the exponent. Asking "what is log2(8)?" is the same as asking "2 to the power of what gives 8?" The logarithm reformulates a multiplication question as a question about the exponent, and that single reformulation is what unlocks a surprising amount of science, engineering, and computer science. It is why the same mathematical operation handles earthquakes, sound intensity, acid levels in chemistry, growth rates in finance, and the running time of binary search all at once.
The Logarithm Formula and the Change of Base Rule
The general definition of a logarithm is written in two equivalent forms:
log_b(x) = y ⟺ b^y = x
The change of base identity rewrites any base in terms of the natural log:
log_b(x) = ln(x) ÷ ln(b)
This identity is the reason a single calculator that knows how to compute ln can answer a question for any base. Once you have ln(x) and ln(b), you divide and you are done. The formula is exact: no approximation is involved beyond the precision of the natural log itself, which most browsers compute to fifteen or sixteen significant digits. For special bases like 2, 10 and e, modern JavaScript engines ship built-in high-precision functions, so log2(8) returns exactly 3 rather than 2.9999999999999996, while genuinely irrational results like log10(7) keep their full decimal detail. Tiny floating-point noise — a stray 3.0000000000000004 where 3 was meant — is trimmed to twelve significant figures, which is enough to clean up that artifact without ever hiding a real fractional result.
Working the change of base formula by hand: to find log5(25), compute ln(25) ÷ ln(5). The ratio is exactly 2, and the sanity check is 5^2 = 25. Once that one identity is internalised, every other base is the same two-step recipe — compute ln(x), compute ln(b), divide.
A handful of log identities also come up when checking work by hand:
- Product: log_b(mn) = log_b(m) + log_b(n)
- Quotient: log_b(m/n) = log_b(m) − log_b(n)
- Power: log_b(m^n) = n · log_b(m)
- Change of base: log_b(x) = ln(x) ÷ ln(b) = log10(x) ÷ log10(b)
Memorising the last one is enough to solve nearly every practical problem, and the calculator handles the rest.
How to Calculate the Logarithm of a Number
The fastest way to get log_b(x) for any positive number and any base is the Logarithm Calculator. It runs entirely in your browser, so nothing is sent to a server and the answer appears the moment you stop typing. Follow these steps:
- Type the number you want the logarithm of into the Argument (x) field. The value must be greater than 0.
- Enter a base in the Base field. Leave it blank if you want the natural log (ln), which uses e as the base.
- Read the result the moment you stop typing. The tool shows log_base(x) directly, along with ln(x), log10(x), and log2(x) for the same argument.
- Glance at the 2^exponent-style explanation under the answer — for clean results like log2(8) it shows "log2(8) = 3" with the matching "2^3 = 8" reasoning so the abstract answer becomes concrete.
If you are checking a homework problem by hand, the order of operations is the same every time: compute ln(x), compute ln(b), divide. For common arguments like log2(8) the division comes out to a clean integer, but for arbitrary values such as log10(7) the result is irrational and the calculator shows the rounded decimal rather than dropping precision. For a deeper walkthrough of the same tool, the guide on calculating logarithms in any base instantly covers the change of base step in more detail.
ln, log10, and log2 Compared
Most real problems reduce to one of three bases. Knowing which to reach for saves time and prevents unit confusion.
| Notation | Base | Where it shows up |
|---|---|---|
| ln(x) | e ≈ 2.71828 | Continuous compound growth, half-life decay, calculus derivatives, information-theoretic entropy (after dividing by ln 2) |
| log(x), log10(x) | 10 | pH in chemistry, decibels in acoustics, the Richter scale for earthquakes, stellar magnitudes |
| log2(x) | 2 | Binary search depth, the height of a balanced tree, the O(log n) running time of many algorithms, bits required to encode x items |
Each row corresponds to a base that covers an entire field of practice. When no base is written at all, "log" most often means log10 in school and engineering contexts, but in higher mathematics "log" frequently defaults to the natural log. The Logarithm Calculator removes that ambiguity by showing all three values side by side, so you do not have to remember which convention your textbook follows.
Input Limits: What the Calculator Accepts
Logarithms are only defined on a restricted domain, and a good calculator enforces that instead of returning a broken value. Here is what the inputs allow and why:
| Input | Allowed | Reason |
|---|---|---|
| Argument x | Greater than 0 | No real power of a positive base equals 0 or a negative number |
| Base b | Greater than 0, not equal to 1 | Base 1 forces ln(b) = 0 in the change of base formula, which divides by zero |
| Negative base | Not allowed | Raises the argument to non-integer powers that do not exist in the real numbers |
If you type 0, −5, or 1 in the base field, the calculator returns a clear "undefined" message rather than a misleading number. This validation matters because the change of base formula divides by ln(b), so a base of 1 forces division by zero, and a negative base has no real-valued logarithm at all.
Worked Example: log2(8) = 3
Suppose you want to calculate log2(8). The question this asks is "what power of 2 equals 8?" The answer is 3, because 2^3 = 8. Using the change of base formula as a sanity check:
log2(8) = ln(8) ÷ ln(2) ≈ 2.07944 ÷ 0.69315 ≈ 3.0000
The logarithm of 8 in base 2 is exactly 3, with no rounding required. By contrast, log10(7) is irrational — no clean power of 10 equals 7 — and comes out to roughly 0.845098 with full decimal detail. The calculator keeps that distinction honest: whole-number answers use an equals sign, while genuine fractions show an approximately-equal sign so the result is never silently rounded.
Where Logarithms Show Up Outside Class
Once you start looking, logarithms appear almost everywhere measurements involve a huge dynamic range. The pH of a solution is −log10 of its hydrogen-ion concentration, so a pH of 3 is ten times more acidic than a pH of 4. Decibels compare sound intensity on a base-10 scale, so a 90 dB subway is not twice as loud as a 60 dB conversation but roughly a thousand times more intense. Earthquake magnitude on the Richter scale is base 10 as well — a magnitude 7 quake releases ten times the shaking amplitude of a magnitude 6. In computing, log2 describes the depth of a balanced binary search tree, the number of times you can halve a list before it collapses, and the bit-length needed to encode a number. In finance, continuous compound interest uses e and ln directly, which is why the natural log is the default base in most growth and decay models.
The same base-2 reasoning explains why doubling the size of a sorted list only adds one extra comparison per halving in a binary search, and why doubling the memory of a computer multiplies its address space but does not multiply the cost of a balanced search. Continuous compound growth, radioactive half-life, and the way probability compounds over many independent trials all sit on the natural log for the same reason: when change is proportional to the current value, the math reduces to e and ln.
For any of those — pH conversion, binary-tree depth, O(log n) running time, or solving b^y = x for the exponent y — the fastest path is the Logarithm Calculator, which returns the answer and shows the reasoning the moment you stop typing. Everything runs locally in your browser, so it works offline once the page has loaded and your inputs never leave your device.