Fixed-Point Q-Format Converter
Enter a value and the number of fractional bits to convert to or from Q-format fixed point.
Result
How it is calculated
With n fractional bits the scale is 2n. In the real-to-fixed mode the stored integer is raw = round(value × 2n), the value it represents is real = raw ÷ 2n, and the quantization error is value − real. In the fixed-to-real mode the number you type is taken as the raw integer (rounded to a whole number if it has decimals), and the error is zero. The resolution is the size of one step, 1 ÷ 2n. The number of fractional bits must be a whole number from 0 to 62, and results whose raw integer is too large to show exactly are refused. Halves round away from zero. The tool does not apply a word length, so it does not clip or wrap values to 16 or 32 bits.
Worked example
Convert 0.3 to a Q15 format (15 fractional bits). The scale is 215 = 32,768, and 0.3 × 32,768 = 9,830.4, which rounds to a raw integer of 9,830. Converting back, 9,830 ÷ 32,768 = 0.29998779. The error is 0.3 − 0.29998779 = 0.0000122070, well inside the step size (resolution) of 0.0000305176. The firmware would store 9830 and treat it as approximately 0.3.
Common mistakes
- Typing the raw integer while the mode is real-to-fixed (or the real value in fixed-to-real mode). 9830 in real-to-fixed mode is scaled again to a raw of 322,109,440.
- Confusing the fractional bit count n with the total word length. Q15 or Q1.15 uses n = 15; the sign bit and the word size are not asked for here.
- Forgetting the range limit of your word. The tool does not clip: a value of 2 with 15 fractional bits gives raw 65,536, which does not fit in a signed 16-bit register (largest 32,767).
- Expecting an exact conversion. Most decimals such as 0.3 are not multiples of the resolution, so a small non-zero error is normal, and it can be negative.
- Entering a fractional bit count with decimals or above 62. Values such as 2.5, -1 or 63 give no result.
About this calculator
Q-format (Qm.n notation) represents a real number as a fixed-point integer by reserving n bits for the fractional part: the stored raw integer equals the real value multiplied by 2ⁿ, so a Q15 (Q1.15) value in a 16-bit word has a resolution of 1/2¹⁵ ≈ 0.0000305 and a range of roughly −1 to 0.99997. Converting a real number to Q-format means rounding value × 2ⁿ to the nearest integer, which introduces quantization error equal to the difference between that rounded integer (scaled back) and the original value.
Embedded-systems and DSP (digital signal processing) engineers use Q-format on microcontrollers and DSP chips without a hardware floating-point unit — common in audio codecs, motor-control firmware, and older ARM Cortex-M and TI TMS320 designs — because fixed-point arithmetic runs faster and more predictably than software-emulated floating point. This calculator converts either direction and reports the resolution and rounding error so firmware developers can judge whether a given bit width is precise enough for their signal chain.
Was this helpful?
You can pick up to 3 reactions.
Popular calculators
Loan Calculator
Monthly payment, total interest and full amortization schedule.
Percentage Calculator
Percent change, percent of, and ratio calculations.
Discount Calculator
Calculate final price, savings, and discount amount.
BMI Calculator
Body mass index from height and weight (metric or imperial).
Age Calculator
Compute your exact age in years, months and days from a birth date.
Compound Interest Calculator
Calculate the final amount and interest earned with compounding.
All Calculators
- Loan Calculator
- Profit Calculator
- Discount Calculator
- BMI Calculator
- Percentage Calculator
- Ideal Weight Calculator
- Age Calculator
- Pregnancy Due Date Calculator
- Compound Interest Calculator
- BMR Calculator (Basal Metabolic Rate)
- Tip Calculator
- Fuel Cost Calculator
- Date Difference Calculator
- Sleep Cycle Calculator
- Daily Water Intake Calculator
- Simple Interest Calculator
- Heart Rate Zones Calculator
- Running Pace Calculator
- Pet Age Calculator
- Calories Burned Calculator
- Macro Calculator
- TDEE Calculator (Total Daily Energy Expenditure)
- Waist-to-Hip Ratio Calculator
- Honor Roll Calculator
- One Rep Max (1RM) Calculator
- Ovulation Calculator
- Electricity Cost Calculator
- Unit Price Calculator
- Savings Goal Calculator
- Break-Even Point Calculator
- Paint Calculator
- Course Grade Average Calculator
- Business Days Calculator
- Time Duration Calculator
- Fuel Economy Calculator
- Temperature Converter
- Tile Calculator
- Aspect Ratio Calculator
- Roman Numeral Converter
- Goal Weight Timeline Calculator
- Salary Converter (Hourly to Annual)
- Credit Card Validator (Luhn)
- Body Surface Area (BSA) Calculator
- Feels-Like Temperature Calculator
- Ohm’s Law Calculator
- PPI (Pixel Density) Calculator
- Molar Mass Calculator
- Zodiac Sign Calculator (Western + Chinese)
- IBAN Validator
- Shoe Size Converter
- Country Info & Dialing Code Lookup
- Time Zone Difference (World Clock)
- CAGR (Compound Annual Growth Rate) Calculator
- Rule of 72 Calculator
- Blood Alcohol Content (BAC) Calculator
- Lean Body Mass (LBM) Calculator
- Pythagorean Theorem Calculator
- Speed Converter
- Download Time Calculator
- Date Calculator (Add/Subtract)
No calculators found
Comments (1)
To pick the number of fractional bits, start from the precision you need: the resolution is 2 to the power of minus n, so a step of 0.001 or finer needs at least 10 bits (about 0.00098). Whatever is left of your word length, minus one sign bit, is what remains for the integer range. What word length are you targeting, 16 or 32 bits?