Q-Format Fixed-Point Converter
Convert Q7, Q15, Q31, Q1.15, and Q16.16 values between decimal, raw integer, hex, and binary. Inspect exact stored values, quantization error, rounding, and overflow locally.
Stored representation
- Quantization error
- Scale
- Representable range
- Resolution
- Conversion flags
Decode register words or a hex dump
Paste up to 256 hexadecimal words separated by spaces, commas, or newlines. Each token is decoded independently; byte order is not changed.
| Token | Hex word | Unsigned raw code | Signed stored integer | Exact stored value |
|---|
Our engineering team verifies fixed-point vectors with exact BigInt rational arithmetic and explicit boundary tests.
What is Q-format fixed point?
Q-format stores a real value as an integer plus an implied binary scale. For a word with F fractional bits, stored integer N represents N / 2^F; the point is not physically stored in the word. A signed word normally uses W-bit two's complement, while an unsigned word uses the full code range. This makes multiplication, filtering, and register storage predictable on hardware without floating-point support, but it also makes range, rounding, saturation, and notation part of the data contract. Q labels are not completely standardized, so this converter treats signedness, total width W, and fractional bits F as the canonical definition and displays them beside every result.
Converter features
Four synchronized representations
Encode or decode decimal, stored integer, hexadecimal word, and binary word from one authoritative input without passing through JavaScript Number.
Exact stored value and error
BigInt rational arithmetic prints the terminating decimal represented by the word and the signed quantization error from the original decimal input.
Explicit rounding and overflow
Compare nearest-even, truncation, and floor together with error, saturation, and two's-complement wrapping instead of assuming a hidden policy.
Common presets plus custom width
Start with Q7, Q15/Q1.15, Q31/Q1.31, or Q16.16, then define signed or unsigned formats from 1 to 64 total bits.
Bounded register-word decoder
Paste up to 256 hexadecimal words and decode valid rows independently while malformed or too-wide tokens remain visible as row-level errors.
Q-format conversion examples
Encode decimal 0.1 as signed Q15
Q15, decimal 0.1, round to nearest ties to even
raw integer 3277; hex 0x0CCD; exact value 0.100006103515625
Q15 scales by 2^15 = 32768. The ideal scaled integer is 3276.8, so nearest-even rounding stores 3277. Dividing that integer by 32768 gives the exact stored value; the quantization error is +0.000006103515625.
Decode the Q15 register word 0xC000
Q15 hex C000
raw code 49152; signed integer -16384; exact value -0.5
The 16-bit word has its sign bit set. Two's-complement interpretation turns raw code 49152 into -16384, and the Q15 scale converts -16384 / 32768 to exactly -0.5.
Encode 1.5 as Q16.16
Q16.16 decimal 1.5
raw integer 98304; hex 0x00018000; exact value 1.5
Q16.16 uses a 32-bit signed word and 16 fractional bits. Since 1.5 × 65536 is exactly 98304, no rounding is required and the quantization error is zero.
Compare Q15 overflow policies at 1.0
Q15 decimal 1.0
error rejects it; saturate stores 0x7FFF; wrap stores 0x8000
Signed Q15 ranges from -1 to 0.999969482421875, so 1.0 is outside the range. Saturation clamps to the largest word while wrap reduces modulo 2^16 and produces the most negative word.
How to use the Q-format converter
- 1
Define the Q-format
Choose a common preset or Custom, then confirm signedness, total word width W, fractional bits F, and the displayed scale 2^F.
- 2
Choose the source representation
Select Decimal value to encode a real number, or Raw integer, Hex word, or Binary word to decode an existing stored representation.
- 3
Set conversion policies
For decimal input, choose a rounding rule and decide whether an out-of-range result should error, saturate, or wrap.
- 4
Inspect the stored result
Compare the stored integer and raw code with normalized hex and binary, then check exact stored value, quantization error, range, and resolution.
Q-format conversion use cases
- Decode DSP and MCU registers
- Turn signed sensor samples, coefficients, and control-loop words from a register view into exact engineering values.
- Prepare firmware test vectors
- Encode decimal boundary values with the same rounding and overflow policy expected by firmware, then copy normalized raw words into tests.
- Audit quantization error
- Compare the requested decimal value with the exact grid point that a fixed binary scale can store before choosing a word width.
- Read protocol hex dumps
- Decode multiple same-width words without silently changing byte order; reverse bytes first when the protocol stores a different endianness.
Q-format representation details
- Canonical definition
- The converter defines a format by signedness, total bits W, and fractional bits F. The scale is 2^F and the resolution is 2^-F. Signed formats require F ≤ W-1; unsigned formats allow F ≤ W.
- Signed and unsigned ranges
- A signed W-bit word stores integers from -2^(W-1) through 2^(W-1)-1; an unsigned word stores 0 through 2^W-1. Divide both endpoints by 2^F to obtain the value range.
- Two's-complement words
- Hex and binary are always shown as unsigned W-bit raw codes. For signed formats, a code with its top bit set maps to stored integer rawCode - 2^W before scaling.
- Exact decimal parsing
- Decimal input uses an ASCII engineering grammar with optional sign, decimal point, and exponent. It is converted to a BigInt fraction before applying the binary scale, so no intermediate floating-point rounding changes the answer.
- Input boundaries
- Single inputs are limited to 256 characters, 128 significant digits, and exponent magnitude 1000. Batch input is limited to 16 KiB and 256 tokens to keep browser work bounded.
Fixed-point conversion best practices
- Write W and F beside every Q label
- Because Qm.n conventions vary, document signedness, total bits, and fraction bits at protocol boundaries instead of assuming everyone counts the sign bit the same way.
- Match the target's rounding rule
- A test vector is only useful when the converter and implementation use the same midpoint and negative-value rule; truncation and floor are different for negative fractions.
- Treat overflow as an explicit contract
- Saturation is common in DSP, while native integer arithmetic may wrap and validation layers may reject. Select the actual target behavior instead of relying on a language default.
- Confirm byte order separately
- Q-format defines numeric scaling, not byte order. This tool decodes each pasted token as written and does not reorder bytes from a memory or wire dump.
Q-format converter FAQ
What does Q15 mean?
Are Q15 and Q1.15 the same?
How is a negative hexadecimal Q-format word decoded?
Which rounding and overflow modes are supported?
When should I use Q-format instead of IEEE 754?
Does this converter upload my values or hex dump?
Related Tools
View all tools →Number Base Converter — Binary, Hex, Decimal & Octal
Conversion Tools
Convert between binary, hex, decimal, octal and any base (2-36) instantly. Free, private — all processing in your browser.
chmod Calculator — Linux File Permissions
Conversion Tools
Convert Linux file permissions between octal (755, 644) and rwx symbols. Get chmod commands, spot risky settings like 777 — free, right in your browser.
Color Converter — HEX, RGB, HSL & OKLCH
Conversion Tools
Convert HEX to RGB, HSL, OKLCH, OKLAB and CMYK in your browser — copy any format with one click. Free, no signup, your colors never leave the page.
Hex to CMYK Converter
Conversion Tools
Convert HEX colors to CMYK in your browser. Naive sRGB-based approximation for print previews. Free, no signup, your colors stay local.
Hex to HSL Converter
Conversion Tools
Convert any hex color to HSL in your browser — 3-digit, 6-digit, 8-digit alpha all supported. Free, instant, no signup, your colors never leave the page.
Hex to OKLCH Converter
Conversion Tools
Convert HEX to OKLCH for Tailwind v4 design tokens. Live perceptually-uniform output with Display P3 gamut warnings. Free, browser-only.