Skip to main content
Back to Tools
Web Tools

Bitmask Flag Generator

Generate bitmask flag enums from named flags in TypeScript, C/C++, Go, Rust, Python, and Java. Configurable None/All flags, hex or decimal values. Runs entirely in your browser — your data never leaves your machine.

bitmask bitflags enum flags code-generator permissions

Published May 31, 2026

All interactive tools run entirely in your browser. Your data never leaves your device.

How It Works

Enter your flag names (comma or newline separated), choose a language, and get a ready-to-use bitmask enum. Each flag is assigned a power-of-two value (1, 2, 4, 8, …) allowing flags to be combined with bitwise OR and tested with bitwise AND.

Features

  • 6 languages: TypeScript, C/C++, Go, Rust, Python, Java
  • Optional None and All flags: include zero-value and combined-all-flags constants
  • Hex or decimal values: toggle between 0x1 and 1 notation
  • Up to 32 flags: covers a full 32-bit integer
  • Name sanitization: special characters and leading digits are handled
  • 5 examples: File Permissions, HTTP Methods, User Roles, Feature Flags, Log Level
  • Copy output: one-click copy of generated code
  • Private: all computation runs in your browser — no data transmitted

Use Cases

  • Generating permission flags for access control systems
  • Creating feature flag enums for configuration
  • Defining bitmask-based state machines
  • Generating idiomatic flag types across different languages
  • Quick prototyping of flag-based APIs