Computing & Software
Bit Field Mask, Extraction & Clear Calculator
Build a contiguous bit mask and extract or clear the selected field of an unsigned word.
How the calculation works
Field mask in hexadecimal = bitfield_mask(value,start,width,word_bits) . Extracted field unsigned value = bitfield_value(value,start,width,word_bits) . Word after clearing selected field = bitfield_cleared(value,start,width,word_bits) .
Worked example
Example inputs — Unsigned word value: decimal, 0x hex or 0b binary: 0x1234; Least-significant field bit index (bit zero is LSB): 4; Field width (bits): 8; Total word width: 16. Expected results — Field mask in hexadecimal: 0xFF0; Extracted field unsigned value: 35; Word after clearing selected field: 4100.
Assumptions and limits
Analytical software/hardware scenario, not a benchmark or a live provider quote. Use the actual architecture, workload and billing definitions; overheads not named in the model are excluded. Unsigned numeric bit positions, independent of how the word is serialized into endian byte order. No hardware register is read or written.
Reference and further reading
Read the underlying subject reference. Calculith is an independent implementation; the reference does not endorse or certify this tool.
Related calculators
- Password Entropy & Brute-Force Time Estimate
- CPU Instruction Count & CPI Runtime Calculator
- Amdahl & Gustafson Parallel Speedup Calculator
- Roofline Arithmetic Intensity Performance Calculator
- Memory Bus Theoretical Bandwidth Calculator
Example values are editable. Results are estimates where assumptions apply. Calculations run in your browser. Updated 2026-11-16.