Q-Format Binary Converter
Convert Q-format binary values to decimal or encode decimal values into Q-format binary. Configure integer bits, fractional bits and signed or unsigned representation while checking numeric range, scale, resolution and quantization.
Q Binary to Decimal
Decode a raw Q-format binary word into its decimal value.
Decimal to Q Binary
Encode a decimal number into a selected Q-format binary word.
What Is Q-Format Binary?
Q format is a fixed-point binary representation used to store fractional numbers with a predetermined binary-point position. Instead of storing an exponent, a fixed number of bits is allocated to the integer and fractional parts.
Under the convention used by this converter, a format such as Q4.4 contains four integer-related bits and four fractional bits. In signed mode, the integer-bit count includes the sign bit.
Because the binary point remains fixed, Q-format numbers can perform fractional calculations using integer hardware and fixed-width registers.
Q-Format Conversion Formulas
Q Binary to Decimal
Interpret the raw binary bits as an unsigned or signed stored integer, then divide by the scale.
Decimal to Q Binary
Multiply the decimal input by the scale and round the result to the nearest stored integer.
Q-Format Resolution Reference Table
Resolution is the smallest step between adjacent representable Q-format numbers. Every additional fractional bit divides the resolution by two.
| Fractional Bits | Scale | Resolution | Calculation |
|---|---|---|---|
| 0 | 1 | 1 | 1 / 1 |
| 1 | 2 | 0.5 | 1 / 2 |
| 2 | 4 | 0.25 | 1 / 4 |
| 3 | 8 | 0.125 | 1 / 8 |
| 4 | 16 | 0.0625 | 1 / 16 |
| 8 | 256 | 0.00390625 | 1 / 256 |
| 12 | 4096 | 0.000244140625 | 1 / 4096 |
| 15 | 32768 | 0.000030517578125 | 1 / 32768 |
Common Q-Format Range Examples
| Format | Mode | Total Bits | Resolution | Minimum | Maximum |
|---|---|---|---|---|---|
| UQ2.2 | Unsigned | 4 | 0.25 | 0 | 3.75 |
| Q2.2 | Signed | 4 | 0.25 | -2 | 1.75 |
| UQ4.4 | Unsigned | 8 | 0.0625 | 0 | 15.9375 |
| Q4.4 | Signed | 8 | 0.0625 | -8 | 7.9375 |
| UQ8.8 | Unsigned | 16 | 0.00390625 | 0 | 255.99609375 |
| Q8.8 | Signed | 16 | 0.00390625 | -128 | 127.99609375 |
Worked Example 1: UQ4.4 Binary to Decimal
Worked Example 2: Signed Q4.4 Binary to Decimal
Worked Example 3: Decimal to UQ4.4
Worked Example 4: Q-Format Quantization
When a decimal input is not an exact multiple of the selected Q-format resolution, it must be quantized.
Signed vs Unsigned Q Format
| Feature | Unsigned Q Format | Signed Q Format |
|---|---|---|
| Negative values | No | Yes |
| Sign encoding | None | Two’s complement |
| Minimum value | 0 | Negative |
| Positive range | Larger | Reduced by sign storage |
| Resolution | Controlled by fractional bits | Controlled by fractional bits |
| Common use | Positive quantities | Signals and signed measurements |
Choosing Integer and Fractional Bits
Integer Bits
More integer bits increase the maximum representable magnitude but do not improve fractional resolution.
Fractional Bits
More fractional bits increase precision by creating smaller representable steps.
Fixed Word Width
With a fixed hardware width, increasing fractional precision often reduces the number of bits available for integer range.
Range vs Precision
Selecting an appropriate Q format is therefore a trade-off between numerical range and fractional accuracy.
Where Q-Format Binary Is Used
Digital Signal Processing
Q formats are widely used for filters, audio processing, communications and real-time signal algorithms.
Embedded Systems
Microcontrollers can process fractional quantities using fixed-width integer arithmetic.
FPGA Designs
Fixed bit widths and known binary-point positions map naturally to hardware registers and arithmetic pipelines.
Control Systems
Predictable numeric precision can be useful in deterministic real-time control applications.
Motor Control
Q-format values can represent normalized currents, voltages, speed, position and control-loop coefficients.
Audio Processing
Signed fractional Q formats can efficiently represent samples, coefficients and intermediate signal values.
Q Format vs Floating-Point
| Feature | Q-Format Fixed Point | Floating Point |
|---|---|---|
| Binary point | Fixed | Controlled by exponent |
| Numeric range | Limited | Very large |
| Resolution | Constant | Changes with magnitude |
| Storage | Scaled integer | Sign, exponent and significand |
| Hardware | Often simpler | More complex |
| Typical use | DSP, MCU, FPGA | General and scientific computing |
Important Q-Format Considerations
Always confirm the Q-format convention used by the processor, DSP library, FPGA design or software specification you are working with.
Decimal-to-Q conversion can also introduce quantization error because only values separated by the selected resolution can be represented exactly.