Bit Field / Bitmask / Flags Designer & Decoder
Design and decode bit fields / bitmasks visually. Define named single-bit flags and multi-bit fields within a word (8/16/32/64-bit), validate non-overlap, encode field values into a packed integer (bin/hex/dec), decode a packed integer back into named fields, and generate ready-to-compile code for C/C++, Rust bitflags!, Python IntFlag, Go consts and TypeScript. Includes POSIX file-mode, TCP flags, FAT attributes, ARM CPSR and x86 EFLAGS presets. 100% client-side and offline, BigInt-correct at 64-bit.
About Bit Field / Bitmask / Flags Designer & Decoder
Design and decode bit fields / bitmasks visually. Define named single-bit flags and multi-bit fields within a word (8/16/32/64-bit), validate non-overlap, encode field values into a packed integer (bin/hex/dec), decode a packed integer back into named fields, and generate ready-to-compile code for C/C++, Rust bitflags!, Python IntFlag, Go consts and TypeScript. Includes POSIX file-mode, TCP flags, FAT attributes, ARM CPSR and x86 EFLAGS presets. 100% client-side and offline, BigInt-correct at 64-bit. Everything runs locally in your browser — your data never leaves your device.
How to use
- Enter your input in the tool above.
- Adjust any options to your preference.
- Use the Copy or Download buttons to save the result.
- Everything happens locally — your data never leaves your browser.
FAQ
What is the difference between a bit flag and a multi-bit field?
A single-bit flag occupies exactly one bit position and represents a boolean (set or clear) — e.g. TCP SYN at bit 1. A multi-bit field spans a contiguous range of bits (e.g. bits 2-3 = MODE) and can hold an integer value 0..(2^width - 1). This tool handles both in a single layout: you give each field a name, a start bit (LSB0 or MSB0 numbering) and a width, and the tool validates that fields do not overlap and stay within the chosen word width (8/16/32/64-bit).
How does encoding and decoding work?
Encoding: for each field you enter a value, the tool shifts it into the field's bit range and ORs the result into a packed integer (e.g. A=1, MODE=2 in a 4-bit layout → 0b1001). Decoding: you paste a packed integer in hex/binary/decimal, the tool extracts each field by masking and shifting, and shows the raw value, the enum label if any, and the boolean state for single-bit flags. All arithmetic uses BigInt so 64-bit layouts round-trip exactly with no Number precision loss.
Which languages are supported for code generation?
Five languages: C/C++ (anonymous struct with bitfields plus #define masks and shifts), Rust (bitflags! macro for the single-bit flags and const helpers for multi-bit fields), Python (IntFlag class with @property accessors), Go (const block with masks/shifts and getter/setter funcs), and TypeScript (const enum + helper functions). The generated code round-trips the layout you designed, so decoding in code matches the in-browser decode exactly.
What presets are included?
Five well-known real-world layouts: (1) POSIX file mode (12 bits — setuid/setgid/sticky + rwx × user/group/other), (2) TCP header flags (9 bits — CWR, ECE, URG, ACK, PSH, RST, SYN, FIN, NS), (3) FAT file attributes (8 bits — read-only, hidden, system, volume-label, directory, archive), (4) ARM CPSR (32-bit — mode bits, Thumb, FIQ/IRQ disable, etc.), and (5) x86 EFLAGS (selected status/control flags). Each preset is a complete layout you can edit and re-export as code.
What extra features does this tool have versus other bitmask designers?
(1) Mixed single-bit flags and multi-bit fields in one layout. (2) 8/16/32/64-bit word widths via BigInt (no JS Number precision loss). (3) LSB0 / MSB0 bit-numbering toggle. (4) Overlap & out-of-range validation with field-level error messages. (5) Enum value labels per field (e.g. MODE 0=off, 1=auto, 2=on). (6) Reserved-bit marking for unused regions. (7) Live encode + decode round-trip. (8) Code generation for C/C++, Rust, Python, Go and TypeScript. (9) Five real-world presets (POSIX mode, TCP, FAT, ARM CPSR, x86 EFLAGS). (10) Set/clear/toggle/test helper generation. (11) Save/load layouts in localStorage. (12) History (last 20). (13) Shareable URL with full layout round-trip. (14) Color-coded visual bit strip. 100% client-side and offline — your register definitions never leave the device.
Related tools
.bashrc / .zshrc Alias & Config Manager
Build shell aliases, functions, exports, and PATH edits in a visual editor, then export a clean, commented .aliases file sourced from both .bashrc and .zshrc — with shadowing detection against shell builtins and common CLI tools, function suggestions when args are needed, starter packs (git, docker, kubectl, navigation, safety, ls, dev, devops, data science), import of existing rc files, dedupe, history (localStorage), and shareable URL. 100% client-side.
Add / Subtract Date Calculator
Add or subtract years, months, weeks, days, hours, minutes and seconds from a starting date/time. Calendar-day or business-day mode with custom weekend + holiday list. Month-end policy toggle (clamp to last day vs overflow). Repeat/series mode (e.g. every 2 weeks x 10) with CSV export. Shareable URL. 100% client-side.
Age Calculator
Calculate exact age from a birth date in calendar years/months/days (no negative-day bugs) plus totals in months/weeks/days/hours/minutes/seconds. Next-birthday countdown with weekday. Feb-29 birthday policy toggle. Milestones (1,000 days, 10,000 days, 1 billion seconds). Zodiac sign + Chinese zodiac. Age gap comparison. Shareable URL. 100% client-side.