S + Z Quantization Parameters

Quantization Scale and Zero Point Calculator

Calculate affine quantization scale and zero point from a real-value range and a quantized integer range. Enter the minimum and maximum values for both ranges to determine the parameters required for linear quantization.

Scale Zero Point Affine Quantization Integer Range Real Range
Scale & Zero Point Affine Quantization
Minimum real or floating-point value.
Maximum real or floating-point value.
Minimum integer code.
Maximum integer code.
Scale = (real_max – real_min) / (quant_max – quant_min)
Zero point = round(quant_min – real_min / scale)
Quantization Parameters
Scale
Zero Point
Raw Zero Point
Integer Levels
Real Range
Quantized Range
Real Span
Integer Span

What Are Quantization Scale and Zero Point?

Scale and zero point are parameters used in affine quantization to map a continuous or floating-point numerical range onto a finite set of integer codes.

The scale determines the size of one quantized step in real-value units. The zero point identifies the integer code corresponding approximately to real zero.

Quantization Scale Formula

The scale is calculated by dividing the size of the real-value interval by the size of the quantized integer interval.

scale = (real_max – real_min) / (quant_max – quant_min)

For a real range from -1 to 1 and an integer range from -128 to 127:

Real span:
1 – (-1) = 2

Integer span:
127 – (-128) = 255

Scale:
2 / 255
≈ 0.0078431373

Zero Point Formula

After the scale is known, the affine zero point can be calculated from the minimum endpoints:

zero_point = round( quant_min – real_min / scale )

Because the zero point must represent an integer code, the calculated value is rounded to the nearest integer and then restricted to the supplied quantized range if necessary.

Scale and Zero Point Example

Real range:
-1 to 1

Quantized range:
-128 to 127

Scale:
2 / 255
≈ 0.0078431373

Raw zero point:
-128 – (-1 / 0.0078431373)
≈ -0.5

Rounded zero point:
0

What Does the Scale Represent?

Scale describes the real-value distance between neighboring integer codes.

If the scale is 0.01, increasing the quantized code by one represents approximately 0.01 units in the original real-value domain.

Scale = 0.01

Difference of one integer code:
1 × 0.01
= 0.01 real units

What Does the Zero Point Represent?

The zero point specifies which integer code corresponds to real zero under affine quantization.

When a real range is not symmetric around zero, the zero point may be significantly different from zero.

zero_point = 25

means:
quantized code 25
represents approximately real value 0

Why Is the Zero Point Rounded?

Quantized storage uses integer codes. The mathematical zero-point calculation may produce a fractional result, but a fractional integer code cannot be stored.

The result is therefore rounded to the nearest integer and constrained to the available quantized range.

Common Quantized Integer Ranges

Representation Minimum Maximum Levels
Signed INT8 -128 127 256
Unsigned UINT8 0 255 256
Signed INT4 -8 7 16
Unsigned UINT4 0 15 16

Why These Parameters Matter

Range Mapping

Scale defines how the original numerical interval is distributed across the available integer codes.

Real Zero

Zero point allows real zero to map accurately or approximately into an integer representation.

Low-Precision Storage

The parameters enable compact integer representations to stand in for higher-precision numerical values.

Machine Learning

Scale and zero point are commonly used in affine quantization workflows for low-precision inference.

Important Calculation Notes

Important: this calculator determines scale and zero point only.

The real maximum must be greater than the real minimum.

The quantized maximum must be greater than the quantized minimum.

Quantized minimum and maximum must be whole integers.

Scale is always positive when both ranges are entered correctly.

The mathematical zero point may be fractional before rounding.

The final zero point is rounded to an integer and clamped to the supplied quantized range.

Quantization Scale and Zero Point Calculator FAQs

What is quantization scale?
Scale is the real-value interval represented by one step in the quantized integer domain.
What is a quantization zero point?
The zero point is the integer code that corresponds approximately to real zero in affine quantization.
How is quantization scale calculated?
Scale equals the real-value span divided by the quantized integer span.
How is zero point calculated?
A common affine formula is quant_min minus real_min divided by scale, followed by rounding to an integer.
Why must scale be positive?
A correctly ordered real range and integer range both have positive spans, producing a positive scale.
Can zero point be negative?
Yes. If the selected quantized integer range allows negative codes, the calculated zero point can also be negative.
Why is zero point rounded?
The quantized representation stores integer codes, so the zero point must itself be an integer.
Why is zero point clamped?
A zero point outside the available integer range cannot be represented, so it must be limited to the nearest valid endpoint.
Does this calculator quantize individual values?
No. This page calculates only the scale and zero-point parameters from the supplied ranges.
Scroll to Top