DAC Digital-to-Analog

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.

Binary → Voltage DAC Code Analog Output N-Bit DAC Voltage per Step
DAC Binary Code Conversion Straight Binary
Enter exactly the number of bits selected for the DAC.
Enter the DAC full-scale reference voltage.
Bit width of the DAC input code.
Maximum Code = 2^N – 1
Vout = (DAC Code ÷ Maximum Code) × Vref
This calculator uses an ideal unipolar straight-binary endpoint model: all-zero code produces 0 V and the maximum all-ones code produces Vref.
DAC Analog Output
Ideal Analog Output Voltage
Decimal Code
Hexadecimal
Maximum Code
DAC Resolution
Voltage per Step
Code Percentage
Reference Voltage
Total Codes
Calculation
Normalized Binary Code
Full-Scale Position
000…0 / 0 V 111…1 / 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.

Total Codes = 2^N

Maximum Code = 2^N – 1

For example, an 8-bit DAC has 256 possible codes ranging from decimal 0 through 255.

Minimum: 00000000 = 0

Maximum: 11111111 = 255

DAC Output Voltage Formula

This calculator uses an ideal endpoint-mapped straight-binary model:

Vout = (DAC Code / (2^N – 1)) × Vref

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:

10000000

The binary code equals decimal 128.

Maximum Code: 255

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.

Binary: 00000000

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.

8-bit: 11111111 = 255

Using the endpoint convention on this page:

Vout = 255 / 255 × Vref

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

Binary: 10000000

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:

Voltage per Step = Vref / (2^N – 1)

For an 8-bit DAC with a 5 V reference:

5 / 255 ≈ 0.019607843 V

≈ 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:

100000000000

This equals decimal 2048.

Maximum Code: 4095

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.

Code Percentage = Code / Maximum Code × 100

For decimal code 128 in an 8-bit DAC:

128 / 255 × 100 ≈ 50.196078%

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.

Resolution: How finely can the output range be divided?

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.

This calculator: Vout = Code / (2^N – 1) × Vref

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.

Minimum code: 000…000

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

Important: this calculator models an ideal unipolar straight-binary DAC.

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.

DAC Binary Code Calculator FAQs

What does the DAC Binary Code Calculator do?
It converts an unsigned N-bit binary DAC input code into an ideal analog output voltage using the selected reference voltage.
What formula does this DAC calculator use?
It uses Vout = DAC Code divided by 2^N – 1, multiplied by Vref. This is an endpoint-mapped ideal straight-binary convention.
What does an all-zero DAC code produce?
Under this unipolar model, an all-zero code produces 0 V.
What does an all-one DAC code produce?
Under this calculator’s endpoint convention, the maximum all-ones code produces the selected reference voltage.
What is the maximum code of an 8-bit DAC?
An 8-bit DAC has a maximum unsigned code of 255, represented as binary 11111111.
What is the maximum code of a 12-bit DAC?
A 12-bit DAC has a maximum decimal code of 4095, represented by twelve 1 bits.
How do I convert binary DAC code to decimal?
Interpret the binary code as an unsigned base-2 integer. For example, binary 10000000 equals decimal 128.
Why must binary code length match DAC resolution?
The code width defines the DAC word size. An 8-bit DAC requires an 8-bit code, while a 12-bit DAC requires a 12-bit code.
Is a DAC the opposite of an ADC?
In general direction, yes. An ADC converts an analog signal into a digital code, while a DAC converts a digital code into an analog output.
Will a real DAC produce exactly the calculated voltage?
Not necessarily. Real outputs depend on the DAC transfer function, reference accuracy, gain and offset errors, nonlinearity, loading and other electrical characteristics.
Scroll to Top