ADC Analog-to-Digital

ADC Binary Code Calculator

Calculate the ideal binary output code of an ADC from analog input voltage, reference voltage and ADC resolution. View the resulting binary code together with its decimal and hexadecimal representation.

ADC Binary Code Analog → Digital N-Bit ADC Decimal Code Hex Code
ADC Code Calculator Ideal Unipolar ADC
Analog voltage applied to the ADC input.
Positive full-scale ADC reference voltage.
Number of bits in the ADC output code.
Maximum Code = 2^N – 1
ADC Code = floor[(Vin / Vref) × 2^N]
Result is limited to 0 through (2^N – 1)
This calculator models an ideal unipolar ADC with an input range from 0 V to Vref. Values below 0 V or above Vref are outside this calculator’s supported input range.
ADC Binary Output
Binary ADC Code
Decimal Code
Hex Code
Maximum Code
ADC Bits
LSB Size
Quantized Voltage
Input Ratio
Code Utilization
Calculation -
0 V / Code 0 Input Vref / Full Scale

What Is an ADC Binary Code Calculator?

An ADC Binary Code Calculator determines the digital output code produced by an ideal analog-to-digital converter for a specified analog input voltage. An ADC converts a continuous voltage into one of a finite number of digital codes determined by its bit resolution.

The result is especially useful when working with microcontrollers, data acquisition systems, embedded electronics, sensors, industrial electronics and digital signal processing systems where an analog measurement must be represented as a binary number.

How an ADC Converts Voltage to Binary

An N-bit ADC can represent 2 raised to N different digital code states. For example, an 8-bit ADC has 256 possible codes, while a 12-bit ADC has 4096 possible codes.

Number of code levels = 2^N

Maximum digital code = 2^N – 1

Therefore an 8-bit ADC produces codes from decimal 0 through 255, corresponding to binary 00000000 through 11111111.

ADC Binary Code Formula

For the ideal unipolar model used on this page, the input range begins at 0 V and extends to the reference voltage.

ADC Code = floor[(Vin / Vref) × 2^N]

The calculated code is constrained so it cannot exceed the maximum available digital value:

Maximum Code = 2^N – 1

This means an input exactly equal to Vref produces the maximum available code rather than an impossible code equal to 2 raised to N.

8-Bit ADC Binary Code Example

Consider an ideal 8-bit ADC with a 5 V reference and an input voltage of 2.5 V.

Vin = 2.5 V
Vref = 5 V
N = 8

Levels = 2^8 = 256

Code = floor[(2.5 / 5) × 256]

Code = floor(128) = 128

Decimal 128 represented as an 8-bit binary number is:

10000000

ADC Binary Code Ranges by Resolution

ADC Resolution Number of Levels Decimal Code Range Maximum Binary Code
4-bit 16 0–15 1111
8-bit 256 0–255 11111111
10-bit 1,024 0–1,023 1111111111
12-bit 4,096 0–4,095 111111111111
16-bit 65,536 0–65,535 1111111111111111

What Is ADC Resolution?

ADC resolution specifies how many binary bits are available to represent the analog input. Increasing the number of bits increases the number of available digital levels and allows smaller voltage changes to be represented.

8-bit ADC → 256 levels
10-bit ADC → 1,024 levels
12-bit ADC → 4,096 levels
16-bit ADC → 65,536 levels

This calculator uses the bit resolution to determine the code range. The separate ADC Resolution Calculator is intended for calculations specifically focused on resolution and voltage-per-step analysis.

What Is ADC LSB Size?

The least significant bit, or LSB, represents one ideal ADC code step in this calculator’s model.

LSB Size = Vref / 2^N

For an 8-bit ADC using a 5 V reference:

LSB = 5 / 256 = 0.01953125 V

≈ 19.53125 mV

This means each ideal code step corresponds to approximately 19.53 mV.

ADC Code at Zero Volts

For the unipolar model used here, an input of zero volts produces the minimum digital code.

Vin = 0 V

Decimal Code = 0
8-bit Binary = 00000000

ADC Code at Full Scale

The highest possible N-bit code is one less than the total number of code levels.

8-bit: 2^8 – 1 = 255

12-bit: 2^12 – 1 = 4095

16-bit: 2^16 – 1 = 65535

Therefore an input at the upper supported endpoint is limited to the maximum available code.

ADC Decimal, Binary and Hexadecimal Codes

The same ADC output can be represented using different number systems without changing the underlying digital value.

Representation Example Value
Decimal 128
Binary 10000000
Hexadecimal 0x80

Binary representation is particularly useful when examining ADC registers, individual bits or digital hardware interfaces, while hexadecimal is often more compact for firmware and register documentation.

ADC Quantized Voltage

The digital output represents a discrete quantization level rather than every possible continuous voltage. This calculator also reports the voltage represented by the calculated code using the same ideal step-size convention.

Quantized Voltage = ADC Code × LSB Size

The difference between the actual analog input and its represented level is associated with quantization.

ADC Binary Codes in Microcontrollers

Microcontrollers commonly include ADC peripherals that convert analog signals from sensors, potentiometers, batteries and other voltage sources into digital register values.

For example, firmware may read a 12-bit ADC register containing a value from 0 through 4095. Understanding the corresponding binary code can help when debugging registers, masks, communication packets and embedded measurement logic.

ADC Binary Codes for Sensors

Many sensors ultimately produce an analog voltage that is sampled by an ADC. Temperature sensors, pressure sensors, light sensors, current sensors and position sensors are common examples.

The ADC code is only the digital representation of the measured voltage. Converting that code into a physical quantity such as temperature or pressure requires the sensor’s transfer function or scaling equation, which is outside the purpose of this calculator.

ADC Code vs ADC Resolution

These concepts are related but represent different calculations.

Calculation Main Question
ADC Binary Code What digital code corresponds to this input voltage?
ADC Resolution What voltage step can this ADC represent?

Keeping these calculations separate avoids creating two pages that perform essentially the same task.

Ideal ADC vs Real ADC

The calculator models an ideal ADC. Real analog-to-digital converters can be affected by offset error, gain error, integral nonlinearity, differential nonlinearity, electrical noise, reference-voltage tolerance, temperature drift and other hardware characteristics.

Actual converter transfer functions can also define code transition boundaries differently. For engineering work involving a specific ADC, its datasheet should be treated as the authoritative source.

Unipolar ADC Input Range

This calculator assumes a simple unipolar input range:

0 V ≤ Vin ≤ Vref

It does not model bipolar ADC ranges such as -5 V to +5 V, differential ADC input coding, offset-binary coding, signed two’s-complement ADC output or custom minimum and maximum input ranges.

Keeping those modes out of this page ensures the calculator performs exactly the task described by its title.

Important ADC Binary Code Notes

Important: this calculator models an ideal unipolar ADC.

The supported analog input range is 0 V through Vref.

The number of ADC levels is 2^N.

The maximum code is 2^N – 1.

The calculator uses floor[(Vin / Vref) × 2^N] and limits the result to the valid N-bit code range.

The reported LSB size is Vref / 2^N.

Binary output is padded with leading zeros to match the selected ADC resolution.

An input exactly equal to Vref is limited to the maximum available N-bit code.

This calculator does not model ADC noise, INL, DNL, gain error, offset error, signed bipolar ranges or manufacturer-specific transfer functions.

For a real ADC device, always verify the exact code transition convention and electrical specifications in the manufacturer’s datasheet.

ADC Binary Code Calculator FAQs

What does the ADC Binary Code Calculator calculate?
It calculates the ideal digital output code corresponding to an analog input voltage for a selected ADC reference voltage and bit resolution.
How do I calculate an ADC binary code?
For this ideal model, calculate floor[(Vin / Vref) × 2^N], constrain the result to the valid range from 0 through 2^N – 1, and convert the decimal result to an N-bit binary number.
What is the maximum code of an 8-bit ADC?
An 8-bit ADC has 256 possible levels and a maximum decimal code of 255, which is 11111111 in binary.
What is the maximum code of a 12-bit ADC?
A 12-bit ADC has 4096 possible levels, giving a maximum code of 4095 or 111111111111 in binary.
What binary code does 0 V produce?
For the unipolar ADC model on this page, zero volts produces decimal code 0 and an all-zero binary output.
What happens when Vin equals Vref?
The result is limited to the maximum N-bit code, because 2^N itself cannot be represented by an N-bit unsigned output.
What is ADC LSB size?
In this calculator’s ideal model, one LSB equals Vref divided by 2^N and represents one digital code step.
Why are leading zeros shown in the binary result?
Leading zeros preserve the selected ADC word width. For example, decimal 5 from an 8-bit ADC is displayed as 00000101 rather than simply 101.
Does this calculator support negative input voltages?
No. This page models a unipolar ADC from 0 V through the positive reference voltage.
Does this calculator model a real ADC perfectly?
No. It calculates an ideal code. Real ADC behavior depends on the converter architecture, transfer-function convention, reference accuracy, noise and device-specific electrical errors.
Scroll to Top