DAC Binary Code Calculator
Convert an N-bit binary DAC input code into its ideal analog output voltage. Enter a binary code, reference voltage and DAC resolution to calculate voltage output, decimal code, hexadecimal code and code utilization.
Vout = (DAC Code ÷ Maximum Code) × Vref
What Is a DAC Binary Code Calculator?
A DAC Binary Code Calculator determines the ideal analog output voltage corresponding to a digital binary input code. A digital-to-analog converter, or DAC, performs the opposite general operation of an analog-to-digital converter: it takes a digital value and produces an analog electrical output.
This calculator is useful for embedded development, microcontrollers, control systems, programmable voltage outputs, waveform generation, instrumentation and digital electronics where a DAC register value must be related to an analog voltage.
How Binary DAC Codes Work
An N-bit DAC accepts an N-bit digital word. That word can represent 2 raised to N distinct code values.
Maximum Code = 2^N – 1
For example, an 8-bit DAC has 256 possible codes ranging from decimal 0 through 255.
Maximum: 11111111 = 255
DAC Output Voltage Formula
This calculator uses an ideal endpoint-mapped straight-binary model:
Under this convention, the minimum code maps to zero volts and the maximum all-ones code maps exactly to the selected reference voltage.
8-Bit DAC Binary Code Example
Consider an 8-bit DAC using a 5 V reference and binary input:
The binary code equals decimal 128.
Vout = (128 / 255) × 5
≈ 2.509803922 V
The output is slightly above exactly half of 5 V because code 128 is slightly above the midpoint of the inclusive 0-to-255 endpoint code range.
DAC Code at Zero
For an all-zero straight-binary input, the decimal code is zero.
Decimal: 0
Vout: 0 V
This is the minimum output of the ideal unipolar model.
DAC Code at Full Scale
The maximum binary code contains all 1 bits.
Using the endpoint convention on this page:
= Vref
Therefore an 8-bit all-ones code with a 5 V reference produces an ideal calculated output of 5 V.
DAC Code Ranges by Resolution
| DAC Resolution | Total Codes | Decimal Range | Maximum Binary |
|---|---|---|---|
| 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 |
Binary, Decimal and Hexadecimal DAC Codes
The same DAC input value can be displayed using binary, decimal or hexadecimal notation.
Decimal: 128
Hexadecimal: 0x80
Firmware and register documentation often use hexadecimal because it provides a compact representation while maintaining a direct relationship with binary bits.
What Is DAC Voltage per Step?
Under the endpoint convention used by this page, adjacent ideal output values are separated by:
For an 8-bit DAC with a 5 V reference:
≈ 19.607843 mV per code step
This step definition follows the endpoint mapping selected for this calculator.
12-Bit DAC Example
Suppose a 12-bit DAC uses a 3.3 V reference and receives binary code:
This equals decimal 2048.
Vout = 2048 / 4095 × 3.3
≈ 1.65040293 V
DAC Code Percentage
The code percentage shows how far the selected code lies between the minimum and maximum codes.
For decimal code 128 in an 8-bit DAC:
DAC Binary Code in Microcontrollers
Microcontrollers and embedded processors may contain built-in DAC peripherals or communicate with external DAC chips over interfaces such as SPI or I2C. Firmware commonly writes an integer or binary value into a DAC data register.
This calculator helps translate that digital register value into an ideal analog output level under the selected reference voltage and code convention.
DAC Binary Code for Control Systems
DACs are commonly used to generate programmable setpoints, bias voltages, motor-control references, actuator commands, waveform levels and instrumentation outputs.
The binary code determines the requested output level, although the actual electrical output can differ because of device accuracy, loading, amplifier characteristics and reference-voltage error.
DAC Binary Code vs ADC Binary Code
ADC and DAC operations move information in opposite directions.
| Converter | Input | Output |
|---|---|---|
| ADC | Analog voltage | Digital code |
| DAC | Digital code | Analog voltage |
The existing ADC Binary Code Calculator therefore calculates analog-to-digital conversion, while this page calculates digital-to-analog conversion.
DAC Resolution vs DAC Binary Code
DAC resolution describes the number of available digital levels or the size of an ideal output step. A DAC binary code identifies one particular level within that range.
Binary Code: Which output level is selected?
Why DAC Transfer-Function Convention Matters
Not every physical DAC maps codes to voltage using exactly the same equation. Some idealized calculations divide by 2^N, which means the highest N-bit code remains one LSB below the nominal reference voltage. Other systems use endpoint mapping such as the convention on this page.
The formula is therefore displayed directly in the calculator rather than hiding the assumption.
Ideal DAC vs Real DAC
Real digital-to-analog converters may have offset error, gain error, integral nonlinearity, differential nonlinearity, settling-time limitations, reference error, output-buffer limitations and electrical noise.
Some DACs are voltage-output devices, while others provide current outputs or require external amplifiers. The calculated result on this page represents only the ideal mathematical output voltage for the selected convention.
Unipolar Straight-Binary DAC
This calculator specifically models an unsigned or unipolar straight-binary DAC.
Maximum code: 111…111
It does not interpret two’s-complement DAC codes, offset-binary bipolar ranges, signed output voltages or differential-output coding.
Important DAC Binary Code Notes
The binary input length must exactly match the selected DAC resolution.
Total available codes equal 2^N.
Maximum code equals 2^N – 1.
This page uses Vout = Code ÷ (2^N – 1) × Vref.
The all-zero code produces 0 V.
The all-ones maximum code produces Vref under this calculator’s endpoint convention.
Voltage per code step is Vref ÷ (2^N – 1) for this model.
Leading zeros in the binary input are significant because they preserve the DAC word width.
Real DAC datasheets can use different transfer-function conventions and include electrical errors not modeled here.
This tool does not calculate ADC codes, signed DAC outputs, INL, DNL, settling time, noise or output-current behavior.