Flexbox Generator
Free online flexbox generator for developers. Visual flexbox layout builder. Fast and private.
display: flex; flex-direction: row; flex-wrap: nowrap; justify-content: flex-start; align-items: stretch; gap: 8px;
Embed this tool
Copy and paste the code below into your website to embed this tool for free. An attribution link to The Util Box is required.
<iframe src="https://www.theutilbox.org/embed/flexbox-generator" width="600" height="500" frameborder="0" style="border: none; max-width: 100%;" title="Free Flexbox Generator tool from The Util Box"></iframe> <!-- Free tool by The Util Box — https://www.theutilbox.org/tools/flexbox-generator --> <a href="https://www.theutilbox.org/tools/flexbox-generator">Flexbox Generator by The Util Box</a>
Frequently Asked Questions about Flexbox Generator
Flexbox Generator — Watch justify-content and align-items Work
This flexbox generator turns the five properties that matter into dropdowns and a slider, and
renders three boxes in a live container so you can see exactly what each value does. Change
justify-content and the boxes slide along the row; change
align-items and they move across it. The generated CSS is printed underneath as a
six-line block you can paste into a stylesheet.
- flex-direction — row, row-reverse, column or column-reverse. This defines which axis is the main axis.
- flex-wrap — nowrap, wrap or wrap-reverse. Whether items spill onto new lines when they run out of room.
- justify-content — distributes items along the main axis: flex-start, flex-end, center, space-between, space-around, space-evenly.
- align-items — aligns items across the cross axis: stretch, flex-start, flex-end, center, baseline.
- gap — a uniform 0–50px gutter between items, with no margin hacks.
Main Axis Versus Cross Axis
Nearly every flexbox mistake comes from forgetting that justify-content and
align-items act on perpendicular axes, and that swapping
flex-direction to column rotates both. In a row,
justify-content moves items horizontally and align-items vertically; in a column, it is reversed. Toggling the
direction dropdown while watching the preview is the fastest way to internalise that, and it is why seeing the
result beats memorising the spec.
Also note that gap replaces the old negative-margin pattern entirely: it applies
between items only, never at the edges, which is what you almost always want.
Related Layout Generators
- Grid Generator — two-dimensional layout when one axis is not enough.
- Clip Path Generator — shape the items once they are laid out.
- Box Shadow Generator — style the flex children.
- CSS Formatter — tidy the stylesheet you paste this into.
Everything is computed in the browser.