Logarithm Calculator
Enter a number and a base to compute the logarithm, with the change-of-base steps plus the natural and common logs shown.
What the Logarithm Calculator Does
The calculator takes two inputs — a number x and a base b — and computes log base b of x, which is the exponent y such that b raised to the power y equals x. The headline result shows that exponent, rounded to six decimal places with trailing zeros trimmed so clean answers like 5 or 3 appear without clutter. Below the headline, the breakdown shows the change-of-base calculation step by step: the natural logarithm of your number, the natural logarithm of your base, and their quotient. It also displays the natural log of x (base e) and the common log of x (base 10) as free reference values, since many problems need those alongside the requested base. The calculator accepts any positive base except 1, so you can work with base 2 for computing, base 10 for science, base e (about 2.71828) for continuous growth, or any unusual base your problem demands. It validates both inputs: the number must be positive, the base must be positive, and base 1 is rejected because it is mathematically undefined.How to Use the Logarithm Calculator
Start with the Number (x) field and type the value whose logarithm you want. This is the “result” of the exponentiation — for example, if you want to know what power of 2 gives 100, you enter 100. Next, enter the Base (b): the number being raised to a power. Use 2 for binary and computer-science problems, 10 for scientific and engineering work, or 2.71828 for the natural logarithm e. Any other positive base works too. Press Calculate. The exponent appears in large text, with the full step-by-step breakdown underneath showing exactly how the change-of-base formula produced it. Press Reset to clear the form and try another pair of values — handy when you are comparing logarithms across several bases for the same number.The Formula Behind the Calculator
The calculator uses the change-of-base formula: log base b of x = ln(x) ÷ ln(b), where ln is the natural logarithm (base e). This formula works because every logarithm is proportional to every other logarithm — dividing by ln(b) simply rescales from base e to base b. Why does this identity hold? Start from the definition: if y = log base b of x, then b raised to the power y equals x. Take the natural logarithm of both sides: ln(b^y) = ln(x). A logarithm turns an exponent into multiplication, so y × ln(b) = ln(x), and dividing both sides by ln(b) gives y = ln(x) ÷ ln(b). That is the entire derivation in three steps. Two special cases fall out naturally. When the base is 10, you get the common logarithm used in science and engineering — pH, decibels, and the Richter scale are all base-10 logs. When the base is e (about 2.71828), you get the natural logarithm used for continuous growth, compound interest, and calculus. The calculator gives you both of these for free alongside whatever base you requested.Worked Examples With Full Arithmetic
Example one: log base 2 of 32. First compute ln(32) = 3.465736 and ln(2) = 0.693147. Then divide: 3.465736 ÷ 0.693147 = 5. The calculator shows 5. Sanity check: 2^5 = 32, so the answer is exact — the number 32 is precisely the 5th power of 2. Example two: log base 10 of 1000. Compute ln(1000) = 6.907755 and ln(10) = 2.302585. Then 6.907755 ÷ 2.302585 = 3. The calculator shows 3, and the common-log row also shows 3 — which makes sense, since asking for log base 10 of 1000 is exactly what the common log of 1000 is. Check: 10^3 = 1000. Example three: log base 5 of 125. Compute ln(125) = 4.828314 and ln(5) = 1.609438. Then 4.828314 ÷ 1.609438 = 3. The calculator shows 3. Check: 5^3 = 125, exact again. Example four: log base 2 of 100, a case with no clean answer. Compute ln(100) = 4.60517 and ln(2) = 0.693147. Then 4.60517 ÷ 0.693147 = 6.643856. The calculator shows 6.643856. This tells you that 2 raised to the 6.643856 power equals 100 — it sits between 2^6 = 64 and 2^7 = 128, which is a good reasonableness check. Example five: log base e of 20, the natural logarithm. Enter 20 as the number and 2.71828 as the base. Then ln(20) = 2.995732 and ln(2.71828) = 1, so 2.995732 ÷ 1 = 2.995732. The calculator shows 2.995732, and the natural-log row confirms the same value.Reading Your Result
The headline number is an exponent: it tells you what power your base must be raised to in order to produce your number. When it comes out as a clean whole number like 5 or 3, your number is an exact power of the base — a useful confirmation when you are checking your own mental math. When the result has decimals, like 6.643856, read it as a position between two whole powers: log base 2 of 100 is 6.643856, meaning it lies between 2^6 = 64 and 2^7 = 128, closer to the top. That framing turns an abstract decimal into something you can picture. The two reference rows deserve a glance even when you asked for a different base. The natural log appears in growth and decay problems, and the common log tells you the order of magnitude at a glance: a common log of 2.69897 for 500 says “this number is between 100 and 1000, nearer 1000.” If the change-of-base row shows ln(b) as a tiny number, your base is close to 1 and the result will be large — a hint to double-check that you entered the base you intended.Common Logarithm Mistakes
The most frequent mistake is trying to take the logarithm of zero or a negative number. No power of a positive base can ever produce zero or a negative result, so the logarithm is simply undefined there. The calculator rejects these inputs with a clear message rather than showing a misleading answer. The second classic error is using base 1. Since 1 raised to any power is still 1, there is no meaningful exponent to solve for — log base 1 is undefined for every number. The calculator blocks this input explicitly. A third mistake is confusing a logarithm with division. Log base 2 of 32 is not 32 ÷ 2 = 16; it is the exponent 5, because 2^5 = 32. If your answer looks suspiciously large, you may have divided instead of thinking in exponents. Students also mix up the change-of-base order, computing ln(b) ÷ ln(x) instead of ln(x) ÷ ln(b). The number always goes on top, the base on the bottom. The calculator’s breakdown row shows the division in the correct order so you can verify your hand calculation against it. Finally, remember that logarithms compress: the difference between log 10 and log 100 is the same as between log 100 and log 1000 (one unit each). Treating log-scale differences as if they were linear differences — for example, thinking a 3 dB increase triples loudness when it merely doubles power — is the error that the decibel and Richter scales punish most often.Frequently Asked Questions
1. What is a logarithm in simple terms?
A logarithm is the exponent you need. Log base 2 of 32 is 5 because 2 raised to the 5th power equals 32. It answers “what power of this base gives me that number?” — the reverse of exponentiation.
2. How does this calculator handle bases other than 10?
It uses the change-of-base formula: log base b of x equals ln(x) divided by ln(b). This single formula works for any positive base except 1, so you can enter 2, 10, 2.71828, or any other base and get the correct exponent.
3. What is the natural logarithm?
The natural logarithm, written ln, is the logarithm with base e (about 2.71828). It appears in continuous growth, compound interest, radioactive decay, and calculus. This calculator shows ln(x) for your number in the breakdown on every calculation.
4. What is the common logarithm?
The common logarithm is the logarithm with base 10, used in science and engineering. The pH scale, the decibel scale, and the Richter scale are all base-10 logarithms. The calculator shows log base 10 of your number as a reference row.
5. Why is log base 1 undefined?
Because 1 raised to any power is always 1, there is no exponent that produces any other number. Asking “1 to what power equals 5?” has no answer, so mathematics leaves log base 1 undefined. The calculator rejects a base of 1 with an error message.
6. Can I take the logarithm of zero or a negative number?
No. A positive base raised to any real power always gives a positive result, so no exponent can produce zero or a negative number. The calculator requires a number greater than 0 and shows an error otherwise.
7. What does a decimal answer like 6.643856 mean?
It means your number sits between two whole powers of the base. Log base 2 of 100 is 6.643856, so 100 lies between 2^6 = 64 and 2^7 = 128 — 2 raised to the 6.643856 power equals exactly 100.
8. How do I verify the calculator’s answer by hand?
Raise the base to the reported exponent and check that you get back your number. For log base 2 of 32 = 5, verify 2^5 = 32. For decimal answers like 6.643856, check that the base raised to the rounded exponent lands very close to your number.
9. What base should I use for computer science problems?
Base 2. Binary logarithms measure bits, tree depths, and algorithm complexity — binary search on a million items takes about log base 2 of 1,000,000 ≈ 20 steps. Enter 2 as the base for these problems.
10. What base should I use for pH or decibels?
Base 10. The pH scale is the negative base-10 log of hydrogen ion concentration, and decibels are 10 times the base-10 log of a power ratio. Enter 10 as the base — or just read the common-log row the calculator provides.
11. How many decimal places does the calculator show?
Up to six decimal places, with trailing zeros trimmed. An exact answer like 5 displays as 5, while log base 2 of 100 displays as 6.643856. This keeps clean answers readable and precise answers precise.
12. What is the change-of-base formula?
Log base b of x = ln(x) ÷ ln(b). It converts a logarithm in any base into a ratio of natural logarithms, which is how calculators compute logs for arbitrary bases. The breakdown row shows this exact division for your inputs.
13. Is log(x) + log(y) the same as log(x + y)?
No — a common algebra trap. The rule is log(x) + log(y) = log(x × y): logarithms turn multiplication into addition, not addition into addition. Log base 10 of 100 plus log base 10 of 1000 equals log base 10 of 100,000, not log of 1100.
14. Why do scientists use logarithmic scales?
Because they compress enormous ranges into readable numbers. Earthquake energy spans factors of millions, and sound power spans factors of trillions — a log scale turns those into single- or double-digit numbers where each step means “ten times bigger.”
15. Can logarithms be used for investment doubling time?
Yes. The time to double at growth rate r is ln(2) ÷ ln(1 + r). At 7 percent annual growth, that is 0.693147 ÷ 0.067659 ≈ 10.24 years — the exact version of the famous rule of 72. You can compute both logarithms with this calculator.