# CSS Flexbox Generator

> Set flex properties visually and copy the CSS. Runs entirely in your browser — nothing is uploaded.

Source: https://toffeekit.com/tools/flexbox-generator

**Category:** [Design](https://toffeekit.com/category/design) · **Price:** Free · **Runs:** in your browser, nothing is uploaded

Open the tool: https://toffeekit.com/tools/flexbox-generator

**Also useful for:** flexbox, css flex, justify-content, align-items, flex-wrap, layout

## What you can do

- **Center anything** — Perfectly center an element both ways. ([open with this preset](https://toffeekit.com/tools/flexbox-generator?preset=center))
- **Navigation bar** — Logo left, links right, items vertically centered. ([open with this preset](https://toffeekit.com/tools/flexbox-generator?preset=navbar))
- **Wrapping cards** — Cards that grow to fill rows and wrap on small screens. ([open with this preset](https://toffeekit.com/tools/flexbox-generator?preset=cards))

## How it works

1. Start from a preset such as Center, Navbar, Wrapping cards or Sidebar.
2. Set flex-direction, flex-wrap, justify-content, align-items and the gaps under Container.
3. Click an item in the preview to change its flex-grow, flex-shrink, flex-basis, align-self and order.
4. Copy the CSS, the HTML or the Tailwind classes.

## FAQ

### How do I center a div with flexbox?

Give the parent display: flex with justify-content: center and align-items: center. The Center preset sets this up.

### What is the difference between justify-content and align-items?

justify-content places items along the main axis (the row, by default) and align-items places them across it. Switching to column swaps the two.

### What does flex: 1 mean?

It is shorthand for flex-grow 1, flex-shrink 1 and flex-basis 0%, so items share the free space equally.

### When does align-content do anything?

Only when items wrap onto more than one line. It spaces the lines themselves, which is why it appears here only when flex-wrap is on.

### How do I push one item to the far right?

Give that item margin-left: auto. The Push last right preset shows it.

### Is CSS Flexbox Generator free and private?

Yes. It's free with no sign-up or limits, and it runs entirely in your browser, so what you type or paste never leaves your device. It works on phones and computers alike.

## Privacy

CSS Flexbox Generator runs entirely in your browser. Your files and text are processed on your device and are never uploaded.

## Related tools

- [Color Picker & Converter](https://toffeekit.com/tools/color-picker) — Pick a color and convert HEX, RGB, HSL, OKLCH, CMYK.
- [Gradient Generator](https://toffeekit.com/tools/gradient-generator) — Build linear, radial and conic CSS gradients.
- [Contrast Checker](https://toffeekit.com/tools/contrast-checker) — Check WCAG contrast and find passing colors.
- [Palette Generator](https://toffeekit.com/tools/palette-generator) — Make harmonious palettes from one base color.
- [Shade Scale Generator](https://toffeekit.com/tools/tailwind-shade-generator) — Turn one color into a Tailwind 50–950 scale.
- [Box Shadow Generator](https://toffeekit.com/tools/box-shadow-generator) — Design layered CSS box shadows visually.

