INT8 Quantization Calculator for Float Values – Free

Use this INT8 quantization calculator to turn floating-point values into 8-bit integers with a single scale factor and a zero point of 0, and to check the values you get back.

How to use the INT8 quantization Calculator tool

  1. Enter the floats to convert in the Numeric values box, separated by commas or whitespace.
  2. Select Quantize, or select Example to run the built-in list of five values.
  3. Note the Scale. You need it, together with the integers on the Quantized line, to reconstruct the data.
  4. Check the Dequantized line against your input, then select Copy to save the result.

The INT8 quantization formula used here

The calculator applies symmetric linear quantization. It computes scale = max(|x|) / 127, then q = round(x / scale) for every value, and limits q to the range -127 to 127. Reconstruction is x' = q x scale. No offset is involved, which is why the result always reports Zero point: 0.

An int8 can hold -128, but the code never emits it. Several inference runtimes restrict weights to the same narrow range, because a range that mirrors around zero keeps negation safe and simplifies integer multiply-accumulate kernels.

Worked example: quantize, then dequantize

Take the list 2.4, -0.6, 0.05, 1.27, -2.54. The largest magnitude is 2.54, so the scale is 2.54 / 127 = 0.02. Dividing gives 120, -30, 2.5, 63.5 and -127. The two ties round up to 3 and 64.

After dequantization, 0.05 has become 0.06 and 1.27 has become 1.28. Both are off by 0.01, exactly half a step, which is the largest error this scheme can produce.

Input: 2.4, -0.6, 0.05, 1.27, -2.54

Scale: 0.02
Zero point: 0
Quantized: 120, -30, 3, 64, -127
Dequantized: 2.4, -0.6, 0.06, 1.28, -2.54

Accepted input and error messages

The parser is strict so that a typo cannot silently change the scale.

  • Separators: commas, spaces, tabs and line breaks, in any mix. Repeated separators between two numbers are fine.
  • Number syntax: an optional sign, digits with an optional decimal point, and an optional exponent such as 1e-3.
  • Not accepted: hex, fractions like 1/3, units, or an empty item at the start or end of the list.
  • NaN and Infinity are valid spellings but fail with Value must be finite.
  • More than 100,000 items fail with Enter at most 100,000 values.
  • An all-zero list returns a scale of 1.

Symmetric INT8 in practice, and what this tool skips

Symmetric signed 8-bit codes are the usual choice for the weights of convolution and linear layers in post-training quantization, since weight distributions are roughly centered on zero. Activations after ReLU are one-sided, so they are normally quantized with an affine scheme that adds a zero point. For that case, use the Quantization scale Calculator on this site.

The calculator derives the scale from the largest absolute value in the list and nothing else. It does not calibrate with percentiles, KL divergence or mean squared error, and it applies one scale to all values instead of one per output channel. Paste a single channel at a time if you want per-channel scales.

Frequently asked questions

How do I calculate the scale for INT8 quantization?

For the symmetric scheme on this page, divide the largest absolute value in the tensor by 127. A tensor whose values span -2.54 to 2.4 has a scale of 0.02. Each integer step then represents 0.02 in real units.

Why is the INT8 range -127 to 127 and not -128 to 127?

The full two's complement range has one extra negative code. Leaving it unused makes the range symmetric, so a value and its negation always have valid codes. The calculator clamps to 127 on both sides.

How do I convert INT8 values back to float?

Multiply each integer by the scale. The Dequantized line does this for you and prints nine significant digits. The difference between that line and your input is the quantization error, at most half the scale per value.

Does this calculator support uint8 or asymmetric quantization?

No. It always produces signed codes with a zero point of 0. Asymmetric quantization maps an arbitrary minimum and maximum onto 0 to 255 and needs a nonzero zero point, which the separate scale and zero point tool computes.

Is the data I paste uploaded?

No. The list is parsed and quantized by a script running in your browser, so tensors from private models stay on your machine.

Related tools