What a log actually asks
A logarithm answers one question and only one question: this base, raised to what power, gives this number? Every other thing people say about logs, product rules, natural logs, pH, decibels, is really just a consequence of that single question. Multiplication scales a number up by repeating addition; exponentiation scales it up by repeating multiplication; a logarithm undoes exponentiation the same way subtraction undoes addition and division undoes multiplication. If 10³ = 1000, then log₁₀(1000) = 3 is exactly the same fact, read backwards. Nothing new has been calculated, only the direction of the question has flipped: exponents start with the power and ask for the result, logs start with the result and ask for the power.
That two-way arrow is the entire definition. b is the base, the number being repeatedly multiplied; x is the argument, the result you already have; y is the logarithm itself, the exponent you are solving for. The base has to be positive and cannot equal 1, for reasons covered below, and the argument has to be positive too, because a positive base raised to any real power never produces zero or a negative number.
Evaluating a log versus solving for the exponent
The two tabs above compute the same thing from two directions people actually meet it. "Evaluate a log" is the direction most calculators expect: you already know the base and the number, and you want the logarithm itself, useful for reading off a pH, a decibel level or a magnitude straight from a measurement. "Solve for the exponent" is the homework framing: a question written as "2 to what power gives 128?" is asking to solve 2y = 128 for y, and substituting the definition above turns that instantly into y = log₂(128). Both tabs run the identical calculation; only the words describing it, and which number you think of as the "given" one, change.
Clean powers and the ones that need a decimal
Some logarithms land on an exact whole number because the argument is a clean power of the base: 32 is 2 raised to the 5th power, so log₂(32) is exactly 5, no rounding involved. This calculator checks for that directly, by repeatedly multiplying the base by itself and comparing the running total to your number, rather than trusting a division that could drift by a rounding error. Most logarithms are not that tidy. log₁₀(50), for instance, sits between log₁₀(10) = 1 and log₁₀(100) = 2, and works out to roughly 1.69897, a genuine decimal with no exact fraction of a power behind it. Both kinds of answer are shown with their working: the clean case as a power chain (b raised to the whole-number answer equals your x), the decimal case via the change-of-base rule described next.
The rules that make logs useful
Four algebraic rules, plus two special values, cover almost everything a logarithm is asked to do. Each one below is a direct consequence of the same exponent rule it mirrors, and each is checked against a real, verifiable example.
| Rule | Statement | Worked example |
|---|---|---|
| Product rule | logb(MN) = logb(M) + logb(N) | log₁₀(2) + log₁₀(5) = 0.30103 + 0.69897 = 1 = log₁₀(10) |
| Quotient rule | logb(M÷N) = logb(M) − logb(N) | log₂(16) − log₂(2) = 4 − 1 = 3 = log₂(8) |
| Power rule | logb(Mp) = p × logb(M) | 3 × log₂(4) = 3 × 2 = 6 = log₂(64), and 4³ = 64 |
| Change of base | logb(x) = ln(x) ÷ ln(b) | ln(8) ÷ ln(2) = 2.07944 ÷ 0.69315 = 3 = log₂(8) |
| Log of 1 | logb(1) = 0 | log₅(1) = 0, because 5⁰ = 1 |
| Log of the base | logb(b) = 1 | log₄(7) = 1, because 7¹ = 7 |
The product and quotient rules are exponent addition and subtraction wearing a different hat, since multiplying two powers of the same base adds their exponents and dividing subtracts them; a logarithm is just the exponent, so the same addition and subtraction carry straight across. The power rule follows for the same reason, repeated multiplication of exponents becomes repeated addition of logs. Change of base is the one rule that turns a calculator with only two log buttons into a calculator that can find a logarithm in any base at all, covered in its own section below.
Common logarithms, worked out
A short table of familiar values is worth more than any rule for building a feel for the scale a logarithm operates on. These three cover the bases this calculator offers directly.
Base 10, the everyday log
| x | log₁₀(x) |
|---|---|
| 0.5 | −0.30103 |
| 2 | 0.30103 |
| 5 | 0.69897 |
| 10 | 1 |
| 100 | 2 |
| 1000 | 3 |
Natural log, base e
| x | ln(x) |
|---|---|
| 1 | 0 |
| e (2.71828) | 1 |
| 10 | 2.30259 |
Base 2, the doubling log
| x | log₂(x) | x | log₂(x) |
|---|---|---|---|
| 1 | 0 | 32 | 5 |
| 2 | 1 | 64 | 6 |
| 4 | 2 | 128 | 7 |
| 8 | 3 | 256 | 8 |
| 16 | 4 | 512 | 9 |
| 1024 | 10 |
Why calculators only have ln and log
Look at any physical scientific calculator and you will usually find exactly two logarithm buttons: "log", meaning base 10, and "ln", meaning base e. Base 10 stuck around because printed log tables and slide rules, the tools that did this job before electronics, were built on it, and counting decimal digits maps neatly onto it. Base e stuck around because it falls out naturally from calculus: e is the one base whose logarithm's rate of change is the simplest possible, 1÷x, so anywhere growth or decay is being modelled, the natural log turns up on its own rather than by choice. Building a dedicated button for every other base was never necessary once the change-of-base rule was known, because logb(x) = ln(x) ÷ ln(b) reaches any base at all from just one of the two buttons already on the keypad. That is exactly the calculation this tool runs whenever you pick "Custom" as the base above.
Natural log versus log base 10
The word "log" on its own is genuinely ambiguous, and which base it silently means depends on who is talking. In most calculators, in chemistry, and in engineering fields like acoustics and seismology, an unadorned "log" means base 10. In pure mathematics, and in most programming languages, an unadorned "log" (or "ln") usually means the natural log, base e; JavaScript's own Math.log function, the one running underneath this page, is natural log by definition, which is exactly why the working below shows ln explicitly whenever a custom base is involved. When a formula or a textbook writes plain "log" without a subscript, check the field it came from before assuming which base is meant.
Where logs show up outside the classroom
pH measures how acidic or alkaline a solution is as the negative base-10 log of the hydrogen-ion concentration, which is why each whole step on the pH scale represents a tenfold change in acidity rather than an equal one. A sound level in decibels is ten times the base-10 log of a power ratio against a fixed reference, the logarithm compressing an enormous range of physical loudness into a scale that roughly matches how human hearing actually perceives it. The Richter and related earthquake magnitude scales are base-10 logs of recorded ground-motion amplitude, so a magnitude 6 quake shakes the ground about ten times harder than a magnitude 5, not twice as hard. Half-life calculations reach for a logarithm whenever the question runs backwards, given how much of a radioactive or decaying substance is left, solving the decay equation for elapsed time takes a log (or ln) to undo the exponential in the first place.
Questions people ask
What does "log" mean if there's no base written?
It depends on the field. Calculators, chemistry and most engineering contexts treat a bare "log" as base 10. Pure mathematics, and most programming languages, usually treat a bare "log" as the natural log, base e. When it matters, look for a subscript, or for the word "ln", which always means base e specifically.
Can I take the log of a negative number?
Not as a real number. A positive base raised to any real power always stays positive, so there is no real exponent that turns a positive base into zero or a negative result. Logarithms of negative numbers exist in the complex numbers, but that is a different question from the one this calculator answers.
Why can't the base be 1 or a negative number?
If the base were 1, every power of 1 is still 1, so there would be no single answer for what power produces a given x, the equation stops pinning down a unique y. A negative or zero base fails for a related reason: its powers either leave the real numbers for fractional exponents or never sweep through the full range of positive results a logarithm needs to be defined for.
Why is log base b of 1 always zero?
Because any positive base raised to the power of zero equals 1, by definition of exponents. Since a logarithm is just asking "what power", and the power that produces 1 is always zero regardless of the base, logb(1) = 0 holds for every valid base.
How do I solve b to the power of y equals x by hand?
Take the log of both sides in any base, most conveniently ln, and the power rule pulls the unknown exponent down in front: ln(by) = ln(x) becomes y × ln(b) = ln(x), so y = ln(x) ÷ ln(b). That is the change-of-base formula, arrived at directly from the equation you started with.
Why does log of zero give an error instead of a very negative number?
As x shrinks towards zero from the positive side, logb(x) does fall without any limit, but it never reaches a specific value at x = 0 itself; there is no power of a positive base that lands exactly on zero. The limit heads towards negative infinity rather than settling on an answer, which is why the result is undefined rather than simply very negative.
This calculator works with real numbers only. Bases and arguments outside the valid range are flagged rather than silently rounded or guessed at.