HomeMath › Logarithm Calculator

Logarithm Calculator

Computes the logarithm of a positive number to any base using the change-of-base formula, and always reports the natural, common (base 10) and binary (base 2) logarithms.

When to use

You need log_b(x) for an arbitrary base, or ln, log10 and log2 of a number at once.

Do not use when: You need to raise a base to a power (use exponent) or a root (use nth-root); for pH-style −log10 of a concentration use ph.

Formula

log_b(x) = ln(x) / ln(b) (change of base); ln = log_e, log10 = log_10, log2 = log_2

Inputs

ParameterTypeUnitRequiredDescription
valuenumberyesPositive number whose logarithm is taken. Range: > 0
basenumberdefault 10Logarithm base; positive and not 1. Use 2.718281828459045 for the natural logarithm, or read the ln output. Range: > 0

Outputs

OutputTypeUnitDescription
lognumberLogarithm of value to the given base.
lnnumberNatural logarithm (base e).
log10numberCommon logarithm (base 10).
log2numberBinary logarithm (base 2).
expressionstringThe evaluated logarithm as text.

Example

log10 of 1000: {"value":1000,"base":10}{"log":3,"ln":6.907755,"log10":3,"log2":9.965784,"expression":"log_10(1000) = 3"}

log2 of 8: {"value":8,"base":2}{"log":3,"ln":2.079442,"log10":0.90309,"log2":3}

GET https://tttkmbb.com/api/v1/calculate/logarithm?value=1000&base=10

Machine access

Sources

FAQ

Why can't the value be 0 or negative?

Real logarithms are only defined for positive numbers: log(0) tends to −∞ and logarithms of negatives are complex.

Which base does 'log' mean?

In science and calculators 'log' usually means base 10, in mathematics often base e, and in computing base 2. All three are reported so no convention is assumed.

Related calculators