Negative Log Calculator - Compute -log(x) for Any Base

Calculate the negative logarithm −log_b(x) for any positive value and base — including pH, surprisal, and custom-base computations.

Enter a positive value and a base to compute its negative logarithm. Supports base 10 (common log), base 2 (binary), and base e (natural log).

Negative Log Calculator - Compute -log(x) for Any Base
Calculate the negative logarithm −log_b(x) for any positive value and base — including pH, surprisal, and custom-base computations.

About the negative log calculator

The negative logarithm, written −log_b(x) or −log(x) when the base is implied, is simply the additive inverse of an ordinary logarithm. If log_b(x) answers the question "to what power must b be raised to get x?", then −log_b(x) flips the sign of that answer. Although the concept seems trivially simple, the negative log turns up so pervasively in science and engineering that it deserves a dedicated calculator. The most famous application is pH in chemistry. The pH of a solution is defined as −log₁₀[H⁺], where [H⁺] is the molar concentration of hydrogen ions. Because hydrogen-ion concentrations span many orders of magnitude — from roughly 10⁻¹⁴ M in strongly basic solutions to nearly 10⁰ M in strongly acidic ones — working directly with these tiny numbers is inconvenient. Taking the negative log compresses the entire range to the familiar 0–14 pH scale. Pure water at 25 °C has [H⁺] = 10⁻⁷ M, so its pH = −log₁₀(10⁻⁷) = 7. In information theory, the negative base-2 logarithm gives the surprisal (or self-information) of an event. If an event occurs with probability p, its surprisal is −log₂(p) bits. A certain event (p = 1) has zero surprisal; a very rare event (p = 0.001) has about 10 bits of surprisal. Shannon entropy is just the expected surprisal over all outcomes of a random variable. In acoustics, the negative log is related to signal attenuation. In finance, the negative log-likelihood is the standard loss function maximised in maximum-likelihood estimation. In thermodynamics, the Gibbs free energy equation contains ln of equilibrium constants, which are frequently expressed as their negative log pKa, pKb, and pKw values in chemistry. The negative log is also used in the Richter scale (magnitude = log of ground motion relative to a reference), in stellar magnitude measurements in astronomy, in the pOH scale, and in defining the acid dissociation constant pKa = −log₁₀(Ka). This calculator evaluates −log_b(x) = −ln(x)/ln(b) using IEEE-754 double precision. You can enter any positive base other than 1 — including Euler's number e (enter 2.71828) for the negative natural log. Results are accurate to ten significant digits for all ordinary inputs.

Negative log examples

Four examples spanning chemistry, information theory, and mathematics.

Input−log resultApplication
x = 1×10⁻⁷, base = 107pH of pure water at 25 °C. −log₁₀(10⁻⁷) = 7. This is the foundational pH calculation in chemistry.
x = 0.25, base = 22Surprisal of an event with 25% probability: −log₂(0.25) = 2 bits. An event that occurs 1 in 4 times conveys 2 bits of information.
x = 0.5, base = e ≈ 2.71828≈ 0.6931Negative natural log of 0.5: −ln(0.5) = ln(2) ≈ 0.6931. Equivalent to the half-life constant in first-order decay.
x = 81, base = 3−4−log₃(81) = −4 because 3⁴ = 81, so log₃(81) = 4 and its negation is −4. An example of custom-base negative log.

How to use the negative log calculator

  1. Enter a positive number in the Value (x) field. For very small numbers like 0.0000001 you can type them as decimals or in scientific notation (1e-7).
  2. Enter the logarithm base in the Base field. Use 10 for common (pH-style) calculations, 2 for information-theoretic bits, or 2.71828 for the negative natural log.
  3. Click Calculate. The result appears immediately, showing the full equation and the underlying formula.
  4. Click Reset to clear both fields back to their defaults and start a new calculation.
  5. Use the example buttons beneath the table to load pre-filled scenarios for pH, surprisal, or the negative natural log.

Negative log calculator FAQ

What does the negative log calculate?
The negative log −log_b(x) returns the ordinary logarithm log_b(x) multiplied by −1. If log₁₀(0.001) = −3, then −log₁₀(0.001) = 3. The negative log is mainly used to convert very small positive numbers — such as ion concentrations or probabilities — into convenient positive values for labelling scales like pH and surprisal.
Why is pH defined as the negative log?
Hydrogen-ion concentrations in water range from about 10⁻¹⁴ M to 1 M, which is a 100-trillion-fold span. Expressing these values as their negative base-10 logarithm compresses this unwieldy range onto the familiar 0–14 scale where higher numbers mean lower acidity. The negative sign makes the scale positive: a concentration of 10⁻⁷ gives pH = −log₁₀(10⁻⁷) = 7.
Can the negative log be negative?
Yes. For values of x greater than 1 with a base greater than 1, log_b(x) is positive, so −log_b(x) is negative. For example, −log₁₀(100) = −2. In the pH context, strong acids can technically have negative pH values, though this is unusual in practice. The calculator handles all such cases correctly.
What base should I use for information-theoretic surprisal?
Use base 2 for surprisal measured in bits, which is standard in computer science and information theory. Use base e for surprisal in nats, preferred in physics and statistics. Use base 10 for surprisal in hartleys (dits), which is less common. The choice of base changes the unit but not the relative ordering of surprisal values.
What is pKa and how does negative log relate to it?
pKa is the negative base-10 log of the acid dissociation constant Ka: pKa = −log₁₀(Ka). Acids with Ka = 0.01 have pKa = 2, meaning they are relatively strong. Acids with Ka = 10⁻¹⁰ have pKa = 10, meaning they are very weak. The negative log transform makes it easy to compare acids across many orders of magnitude of strength using small, positive numbers.
Does the base matter for the sign of the result?
Yes, indirectly. For base > 1 and 0 < x < 1, the log is negative, so the negative log is positive. For base > 1 and x > 1, the log is positive, so the negative log is negative. For 0 < base < 1, the signs are reversed. This calculator supports any valid base (positive and ≠ 1), so you can explore all these scenarios.