# Henderson–Hasselbalch Calculator

> Computes the pH of a buffer from the acid's pKa and the concentrations (or ratio) of conjugate base and weak acid with the Henderson–Hasselbalch equation, or the base/acid ratio required for a target pH.

- Calculator id: `henderson-hasselbalch` · Category: Chemistry (`chemistry`) · Tool name: `calculate_henderson_hasselbalch_ph`
- Canonical page: https://tttkmbb.com/chemistry/henderson-hasselbalch · This document: https://tttkmbb.com/chemistry/henderson-hasselbalch.md · JSON definition: https://tttkmbb.com/chemistry/henderson-hasselbalch.json

## Purpose

Computes the pH of a buffer from the acid's pKa and the concentrations (or ratio) of conjugate base and weak acid with the Henderson–Hasselbalch equation, or the base/acid ratio required for a target pH.

**Use when:** You are preparing or analysing a buffer and need its pH from pKa and composition, or the acid-to-base ratio that gives a chosen pH.

**Do not use when:** The solution is a strong acid or base (use ph), the buffer is very dilute (below about 1 mM) or the pH is more than about 1.5 units from pKa, where the approximation breaks down.

## Input

| Parameter | Type | Unit | Required | Description |
| --- | --- | --- | --- | --- |
| `pka` | number |  | required | Acid dissociation constant exponent of the weak acid (e.g. acetic acid 4.76, H2PO4⁻ 7.21, NH4⁺ 9.25, carbonic acid in blood 6.1). (min -10, max 25) |
| `base_concentration` | number |  | optional | Concentration of the conjugate base (e.g. acetate), in any unit shared with acid_concentration. (> 0) |
| `acid_concentration` | number |  | optional | Concentration of the weak acid (e.g. acetic acid), same unit as base_concentration. (> 0) |
| `ratio_base_to_acid` | number |  | optional | Base-to-acid ratio; alternative to giving both concentrations. (> 0) |
| `ph` | number |  | optional | When given, the calculator solves for the [A⁻]/[HA] ratio that produces this pH instead of computing pH. (min -2, max 16) |

## Output

| Field | Type | Unit | Description |
| --- | --- | --- | --- |
| `ph` | number |  | Buffer pH = pKa + log10([A⁻]/[HA]). |
| `ratio_base_to_acid` | number |  | Conjugate base to weak acid ratio, given or solved. |
| `log_ratio` | number |  | pH − pKa. |
| `base_percent` | number | % | Share of the pair present as conjugate base: 100 × ratio / (1 + ratio). |
| `acid_percent` | number | % | Share present as undissociated acid. |
| `base_concentration` | number |  | Conjugate base concentration (when known or derivable from acid_concentration and the ratio). |
| `acid_concentration` | number |  | Weak acid concentration (when known or derivable from base_concentration and the ratio). |
| `buffer_range` | string |  | pKa ± 1, the range in which the buffer resists pH change effectively. |
| `solved_for` | string |  | ph or ratio_base_to_acid. |

## Formula

`pH = pKa + log10([A⁻] / [HA]); ratio = [A⁻]/[HA] = 10^(pH − pKa); base_percent = 100 × ratio / (1 + ratio)`

Valid when both buffer components are much more concentrated than [H⁺] and [OH⁻] and activity coefficients are close to 1; for accurate work use the pKa at the working temperature and ionic strength.

## Data Sources

- OpenStax Chemistry 2e – 14.6 Buffers — https://openstax.org/books/chemistry-2e/pages/14-6-buffers (textbook, retrieved 2026-09-23)
- Wikipedia – Henderson–Hasselbalch equation — https://en.wikipedia.org/wiki/Henderson%E2%80%93Hasselbalch_equation (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/henderson-hasselbalch?pka=…`
- `POST https://tttkmbb.com/api/v1/calculate/henderson-hasselbalch` 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/henderson-hasselbalch · OpenAPI operationId `calculate_henderson_hasselbalch_ph` 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": "henderson-hasselbalch", "inputs": {…}}`

## Example

- Acetate buffer 0.2 M acetate / 0.1 M acetic acid: inputs `{"pka":4.76,"base_concentration":0.2,"acid_concentration":0.1}` → `{"ph":5.061,"ratio_base_to_acid":2,"log_ratio":0.301,"base_percent":66.67,"buffer_range":"3.76 – 5.76","solved_for":"ph"}`
- Bicarbonate ratio at blood pH 7.4: inputs `{"pka":6.1,"ph":7.4}` → `{"ratio_base_to_acid":19.953,"log_ratio":1.3,"base_percent":95.23,"acid_percent":4.77,"solved_for":"ratio_base_to_acid"}`

```
GET https://tttkmbb.com/api/v1/calculate/henderson-hasselbalch?pka=4.76&base_concentration=0.2&acid_concentration=0.1
```

## Limitations

The solution is a strong acid or base (use ph), the buffer is very dilute (below about 1 mM) or the pH is more than about 1.5 units from pKa, where the approximation breaks down. Valid when both buffer components are much more concentrated than [H⁺] and [OH⁻] and activity coefficients are close to 1; for accurate work use the pKa at the working temperature and ionic strength. All values are computed from the formula above; no measurement or live data is involved.

## FAQ

**Do I need molar concentrations?**

No. Only the ratio matters, so moles, mmol or any concentration unit work as long as both components use the same unit.

**Why does my measured pH differ from the calculated value?**

pKa shifts with temperature and ionic strength, and the equation ignores activity coefficients; deviations of 0.1–0.2 pH units are common in concentrated buffers.

## Related

- [pH Calculator](https://tttkmbb.com/chemistry/ph.md) — pH of strong acids and bases without a buffer.
- [Molarity Calculator](https://tttkmbb.com/chemistry/molarity.md) — Prepare the acid and base components at the required concentrations.
- [Logarithm Calculator](https://tttkmbb.com/math/logarithm.md) — log10 arithmetic used in the equation.
