# 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.

- Calculator id: `logarithm` · Category: Math (`math`) · Tool name: `calculate_logarithm`
- Canonical page: https://tttkmbb.com/math/logarithm · This document: https://tttkmbb.com/math/logarithm.md · JSON definition: https://tttkmbb.com/math/logarithm.json

## Purpose

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.

**Use when:** 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.

## Input

| Parameter | Type | Unit | Required | Description |
| --- | --- | --- | --- | --- |
| `value` | number |  | required | Positive number whose logarithm is taken. (> 0) |
| `base` | number |  | optional, default 10 | Logarithm base; positive and not 1. Use 2.718281828459045 for the natural logarithm, or read the ln output. (> 0) |

## Output

| Field | Type | Unit | Description |
| --- | --- | --- | --- |
| `log` | number |  | Logarithm of value to the given base. |
| `ln` | number |  | Natural logarithm (base e). |
| `log10` | number |  | Common logarithm (base 10). |
| `log2` | number |  | Binary logarithm (base 2). |
| `expression` | string |  | The evaluated logarithm as text. |

## Formula

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

## Data Sources

- Wikipedia – Logarithm — https://en.wikipedia.org/wiki/Logarithm (reference, retrieved 2026-09-23)
- NIST Digital Library of Mathematical Functions §4.2 – Elementary functions: definitions of the logarithm — https://dlmf.nist.gov/4.2 (standard, retrieved 2026-09-23)
- Wolfram MathWorld – Logarithm — https://mathworld.wolfram.com/Logarithm.html (reference, retrieved 2026-09-23)

Data freshness: `static`. Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output.

## API

- `GET https://tttkmbb.com/api/v1/calculate/logarithm?value=…`
- `POST https://tttkmbb.com/api/v1/calculate/logarithm` with JSON body `{"inputs": {…}}`
- Response: unified envelope (`success`, `request`, `result.values`, `result.units`, `sources`, `freshness`, `timestamp`, `next_actions`, `links`); see https://tttkmbb.com/docs/response-format.md
- Schema: https://tttkmbb.com/api/v1/calculators/logarithm · OpenAPI operationId `calculate_logarithm` in https://tttkmbb.com/openapi.json
- Authentication: none. Rate limit: fair use, see https://tttkmbb.com/docs/rate-limits.md.

## MCP

- Server: `https://tttkmbb.com/mcp` (Streamable HTTP, JSON-RPC 2.0, no auth)
- Tool:  `run_calculator` with `{"calculator_id": "logarithm", "inputs": {…}}`

## Example

- log10 of 1000: inputs `{"value":1000,"base":10}` → `{"log":3,"ln":6.907755,"log10":3,"log2":9.965784,"expression":"log_10(1000) = 3"}`
- log2 of 8: inputs `{"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
```

## Limitations

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. All values are computed from the formula above; no measurement or live data is involved.

## 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

- [Exponent Calculator](https://tttkmbb.com/math/exponent.md) — Inverse operation: b^y = x.
- [Nth Root Calculator](https://tttkmbb.com/math/nth-root.md) — Roots as fractional exponents.
- [pH Calculator](https://tttkmbb.com/chemistry/ph.md) — pH is −log10 of hydrogen-ion concentration.
