CSS Flexbox Generator
Build flexbox layouts visually – direction, wrap, justify, align and gap – with live boxes and ready-to-copy CSS.
Tool
Was this tool useful?
About this tool
About CSS Flexbox Generator
Learn and use flexbox without memorising every property. Change settings and watch the boxes move.
How it works
display: flex controls a single row or column; justify-content works on the main axis and align-items on the cross axis.
Example
justify-content: space-between with three items pushes the first and last to the edges.
How to use this tool
- Choose direction, wrap, justify-content, align-items and gap.
- Change the number of items.
- Copy the container CSS.
Frequently asked questions
Flexbox or Grid?
Use flexbox for one-dimensional rows or columns, and Grid for two-dimensional layouts.
Why doesn’t align-items work?
It needs extra space on the cross axis – give the container a height.
Does the CSS Flexbox Generator send my data to a server?
No. The CSS Flexbox Generator runs entirely in your browser using JavaScript, so tokens, code and data you paste stay on your device. You can even use it offline once the page has loaded.