Live Preview
CSS
display: flex; flex-direction: row; justify-content: flex-start; align-items: stretch; flex-wrap: nowrap; gap: 8px;
100% Private
Everything runs locally in your browser. Nothing is uploaded.
CSS Flexbox Generator builds flexbox layouts visually and copies the CSS online for free. Adjust alignment and direction with a live preview in your browser.
Written & reviewed by Helperzy Editorial Team · Updated July 2026
Live Preview
CSS
display: flex; flex-direction: row; justify-content: flex-start; align-items: stretch; flex-wrap: nowrap; gap: 8px;
100% Private
Everything runs locally in your browser. Nothing is uploaded.
Set flex-direction first, since it decides which axis justify-content controls, then choose your justify, align, wrap and gap values one at a time.
Sample items rearrange instantly, so toggle flex-direction between row and column once to see how the same alignment properties swap axes on you.
Copy the declarations onto your container element, not the children. flex-grow, flex-shrink and flex-basis are the properties that belong on the items themselves.
Flexbox is the CSS layout model for arranging items along a single line, either a row or a column, and distributing the leftover space between them. This generator gives you controls for the container properties, flex-direction, justify-content, align-items, flex-wrap and gap, with sample items rearranging live as you change each one. Front-end developers prototyping a navbar, anyone trying to centre a box vertically without remembering which property does it, and people learning the model for the first time all benefit from the same thing: seeing the effect before committing it to a stylesheet. My honest view is that flexbox is easier to learn by playing than by reading the specification. The concept everything hinges on is the two axes. flex-direction sets the main axis: with the default value row the main axis runs horizontally and the cross axis runs vertically; switch to column and the two swap over entirely. justify-content then distributes items along the main axis, offering values like flex-start, center, space-between and space-around, while align-items positions them along the cross axis with values including stretch, which is the default, center and baseline. That axis swap is why the same property does something completely different once you change direction, and it is the single most common source of flexbox confusion. flex-wrap decides whether items squeeze onto one line or spill onto a second, and gap adds spacing between them without the margin arithmetic that used to be necessary. Try a real case. To build a header with a logo on the left and navigation links pushed to the right, set display flex, flex-direction row, justify-content space-between and align-items center. The generated CSS is four declarations, and the preview shows the first item hard left, the last hard right, and both vertically centred within the container height. Now change flex-direction to column without touching anything else. space-between now distributes the items vertically, pushing them to the top and bottom edges of the container, and align-items center centres them horizontally instead. Nothing but the direction changed, yet the layout is unrecognisable, which demonstrates the axis rule far better than any diagram in a tutorial does. Concrete uses. A developer builds a card footer where a price sits left and a button sits right, using justify-content space-between in two lines of CSS instead of floats. Someone centring a loading spinner both ways uses justify-content center with align-items center, the modern replacement for a stack of absolute positioning hacks. A team building a tag list turns on flex-wrap and sets a gap so the chips reflow neatly on a narrow phone screen. A designer prototypes three pricing columns of equal height, which flexbox provides for free because align-items defaults to stretch. A developer pins a sticky footer to the bottom of a short page using a column layout. Two things worth knowing. Gap is the property people forget exists, and they add margins to children instead, which creates unwanted space at the ends and then needs a negative-margin fix on the parent; gap solves it in one line with no side effects. The pitfall that catches beginners is applying flex properties to the wrong element: justify-content and align-items belong on the container, while flex-grow, flex-shrink and flex-basis belong on the children, and setting a container property on a child does nothing at all. Also remember flexbox is one-dimensional by design, so if you need to align items in both rows and columns simultaneously, CSS Grid is the right tool instead. Flexbox needs no vendor prefixes in any current browser, so the generated declarations are safe to ship as they are. Everything runs in your browser and nothing is uploaded anywhere.
Input
flex-direction row, justify-content space-between, align-items center
Result
.header { display: flex; flex-direction: row; justify-content: space-between; align-items: center; }
The main axis is horizontal, so space-between pushes the first item hard left and the last hard right, while align-items center handles vertical centring on the cross axis.
Input
The same three values but with flex-direction changed to column
Result
.header { display: flex; flex-direction: column; justify-content: space-between; align-items: center; }
Switching direction swaps the axes, so space-between now pushes items to the top and bottom edges while align-items centres them horizontally instead of vertically.
Adjust the controls for flex-direction, justify-content, align-items, flex-wrap, and gap in the Helperzy CSS Flexbox Generator. A live preview updates instantly, and you can copy the generated CSS into your stylesheet.
UUID Generator creates random UUIDs (v4) and GUIDs online for free. Generate unique identifiers instantly for databases, APIs, and development. No signup needed.
Image to Base64 Converter encodes any image into a Base64 data URI online for free. Get ready-to-use CSS and HTML code in your browser.
JSON to YAML Converter changes JSON into clean YAML instantly online for free. Validate and convert config data in your browser with no upload.
Cron Expression Generator builds and explains cron schedules online for free. Create cron expressions with a plain-English description in your browser.
Image Resizer changes image dimensions online — set exact pixels, use percentage scaling, or pick from 12 presets (Instagram, Passport, YouTube, etc.). Target specific file sizes like 50KB or 100KB. Batch resize multiple images. 100% free, browser-based.
Image Converter changes images between any format online free — JPG, PNG, WebP, AVIF, PDF, ICO, BMP, HEIC, GIF, SVG. Batch conversion, resize, rotate, flip, AI format recommendation. 100% browser-based, no upload.
Convert JPG to WebP format online free — reduce image file size by 25-35% with identical visual quality. Batch conversion, adjustable quality, lossless mode available. Boost website speed and Core Web Vitals scores. 100% browser-based, no upload needed.
Convert PNG to WebP format online free — reduce file size by 26-34% while preserving full transparency. Batch conversion, lossless and lossy modes, adjustable quality. Boost website performance and Core Web Vitals. 100% browser-based, no upload needed.