ADC Calculator
Counts ↔ voltage for N-bit ADCs, with LSB size.
convention: ratio = count / (2^N − 1)
This tool converts ADC counts to input voltage and back for 8- to 24-bit converters, and reports the LSB size. It uses the count / (2ᴺ − 1) convention — stated on the panel, since mixing conventions is the classic source of one-LSB disagreements between calculated and datasheet values.
How it works
An ideal N-bit ADC divides its reference voltage into equal steps. Under the convention used here the top code (all ones, 2ᴺ − 1) reads exactly Vref, so V = count × Vref / (2ᴺ − 1) and one LSB is Vref / (2ᴺ − 1). The reverse direction rounds to the nearest code and clamps into the valid range, which is what a real converter does at the rails.
Worked example
count 4095 → 3.3000 V (full scale)
count 2048 → 1.650403 V
LSB = 3.3 / 4095 = 0.805861 mV
Parameters
| Parameter | Value | Notes |
|---|---|---|
| Resolution | 8 / 10 / 12 / 14 / 16 / 24 bit | |
| Convention | ratio = count / (2ᴺ − 1) | full scale = all-ones code |
| LSB | Vref / (2ᴺ − 1) | |
| Reverse | round + clamp | 0 … 2ᴺ − 1 |
C implementation
/* Ideal ADC transfer, convention: ratio = count / (2^N - 1) */
float adc_to_voltage(unsigned count, unsigned bits, float vref)
{
unsigned max_code = (1u << bits) - 1u;
return (float)count * vref / (float)max_code;
}
/* 12-bit, 3.3 V: 4095 -> 3.3000 V, 2048 -> 1.650403 V
* LSB = 3.3 / 4095 = 0.805861 mV */FAQ
▸Which conversion convention does this calculator use?
ratio = count / (2^N − 1), i.e. the all-ones code corresponds exactly to Vref. Some datasheets instead use count / 2^N, where full scale is Vref × (1 − 1/2^N). The difference is one LSB at full scale — check your converter's datasheet, and mind the convention when comparing numbers.
▸What is an LSB in volts?
One least-significant-bit step equals Vref / (2^N − 1) under this convention. For a 12-bit ADC at 3.3 V that is 3.3 / 4095 ≈ 0.805861 mV — the smallest voltage change the converter can represent.
▸Why does count 2048 not give exactly half of 3.3 V?
Half of 4095 is 2047.5, which is not an integer code. Code 2048 is therefore just above mid-scale: 2048/4095 × 3.3 = 1.650403 V rather than 1.65 V exactly.
▸Does this account for ADC error sources?
No — it computes the ideal transfer function only. Offset, gain error, INL/DNL and reference drift add on top; consult the datasheet for those terms.
▸Is my data uploaded?
No. Everything runs locally in your browser.