BEM Class Generator Online
The best BEM naming convention tool. Generate clean, modular, and scalable CSS class lists for your frontend architecture instantly.
Elements & Modifiers
<div class="card"> <div class="card__title card__title--large card__title--bold"></div> <div class="card__content"></div> </div>
.card {
/* block styles */
}
.card__title {
/* element styles */
}
.card__title--large {
/* modifier styles */
}
.card__title--bold {
/* modifier styles */
}
.card__content {
/* element styles */
}
Generated Architecture
BLOCK
.cardELEMENTS & MODS
.card__title--large--bold.card__contentWhy BEM Architecture?
"BEM (Block, Element, Modifier) makes your CSS easier to read, scale, and maintain by providing a strict structural relationship between classes."
Naming Signal
Build a Consistent BEM Class Naming System Across Every UI Component
Use this BEM class generator to keep naming predictable from landing pages to complex product dashboards. The generator helps you write production-ready block, element, and modifier classes that stay readable for designers, developers, and future maintainers.
Better naming lowers CSS debt, improves code review speed, and creates a stable foundation for design tokens, component libraries, and reusable frontend patterns.
BEM Quality Scoreboard
From Selector Chaos to Component-First CSS Architecture
Before
.sidebar .menu ul li a.active { ... }
.sidebar .menu ul li a .icon { ... }
.sidebar.compact .menu ul li { ... }Deep nesting, fragile selectors, and hard-to-track overrides.
After
.sidebar { ... }
.sidebar__link { ... }
.sidebar__link--active { ... }
.sidebar--compact { ... }Flat, readable classes that map directly to component structure.
Production Naming Checklist for Teams Shipping Fast
1. Block Intent
Name blocks by business meaning, not visual style. Prefer checkout-form over blue-box.
2. Element Boundaries
Keep elements scoped to one block context so class ownership remains obvious during refactors.
3. Modifier States
Model interactive states and variants with modifiers such as --loading, --error, and --featured.
Built With Care
“BEM (Block Element Modifier) is the industry standard for component-based CSS architecture. By strictly separating the 'Block' (context), 'Element' (part), and 'Modifier' (state), you eliminate style leaks and specificity wars. This tool ensures you never nest elements (e.g., block__el1__el2), which is a common anti-pattern that destroys reusability.”
BEM Generator & Naming Guide
Generate standard-compliant BEM (Block Element Modifier) class names instantly. Axonix's BEM tool creates modular HTML and CSS scaffolding to help you write cleaner, more maintainable frontend code.
- 1Start by entering the name of your main CSS 'Block' (e.g., 'nav' or 'button').
- 2Add 'Elements' that belong inside that block (e.g., 'item', 'link').
- 3Attach 'Modifiers' to change the state or appearance (e.g., 'active', 'large').
- 4Review the real-time generated HTML structure and CSS scaffolding below.
- 5Copy all generated classes to quickly build out your component styles.
- Visual Mapping: Real-time visualization of the BEM tree and class relationships.
- Smart Formatting: Automatically converts inputs to kebab-case for CSS compatibility.
- Modular Scaffolding: Generates both HTML markup and CSS blueprint concurrently.
- One-Click Copy: Instantly grab all generated architecture for your IDE.
- Best Practices: Enforces a flat hierarchy to prevent CSS specificity issues.
BEM Generator & Naming Guide Specs
Limits
- One block + N elements per session
- Element modifiers as string array
Formats
- Output: BEM class names + sample CSS skeleton
Defaults
- Block 'card' with title/content elements
How it works
- String composition rules
Honest caveats
- Does not enforce naming uniqueness — duplicate element names produce overlapping classes
- No linting for invalid characters
Real Ways People Use This
Design Systems
Standardize component nomenclature across large teams to ensure every button, card, and input follows the same structural pattern.
Refactoring Legacy CSS
Convert tangled, nested CSS selectors into flat, low-specificity BEM classes for better performance and maintainability.
React/Vue Components
Generate the base class structure for new UI components to ensure your CSS modules or SASS files are organized from day one.
CSS-in-JS Migration
Plan out your component props (modifiers) and sub-components (elements) before writing styled-components.
Third-Party Embed Styling
Prefix embedded widgets or plugins with a unique block name so your styles cannot collide with the host page's CSS.
- BEM methodology forbids nesting elements (e.g., block__el1__el2). Always use flat element references.
- Generated class names use kebab-case. Ensure your CSS preprocessor is configured to handle this convention.
- BEM does not replace CSS modules or scoped styles. It is a naming convention, not a scoping mechanism.
- 1Keep names in kebab-case with block__element and block--modifier separators.
- 2Check the tree for nested elements — block__el1__el2 violates BEM.
- 3Copy both the HTML and CSS scaffolds so the generated classes stay in sync.