BFC Layout Debugger - Free Online Tool | IconVault

Visualize Block Formatting Contexts: float containment, margin collapse and float exclusion with live toggles. Free CSS learning tool.

All tools

BFC Layout Debugger

See Block Formatting Contexts fix real layout bugs

5 of 5 free uses left

5 of 5 free measurements left. All demos render live in your browser.

1. Float containment

A parent with only floated children collapses to zero height, because floats are taken out of normal flow. Creating a Block Formatting Context on the parent (with display: flow-root) makes it wrap its floats again.

float: left
float: right

See how the dashed border collapsed to a thin strip? The floats escaped the parent's height.

.parent {
  /* no BFC: height collapses around floats */
}

2. Margin collapse

Two stacked boxes with 40px margins get only a 40px gap, not 80px: adjoining vertical margins collapse. Wrap one box in its own BFC and the margins stop collapsing, giving the full 80px.

Box 1, margin-bottom: 40px
Box 2, margin-top: 40px

Without the wrapper, 40px + 40px collapses to a single 40px gap. Measure it to confirm.

3. Float exclusion zone

Text in normal flow wraps around floats. Put the text in its own BFC and it forms a neat column beside the float instead of flowing underneath it.

float
Lorem ipsum dolor sit amet, consectetur adipiscing elit. A block formatting context is an isolated layout region: floats inside cannot escape it, margins inside cannot collapse with the outside, and floats outside cannot intrude into it. Toggle the switch to see the text stop wrapping under the float and form its own column.
.text {
  display: flow-root; /* BFC: no float intrusion */
}

/* other ways to create a BFC: */
/* overflow: hidden | auto; display: inline-block; */
/* position: absolute | fixed; contain: layout; */

About this tool

IconVault's BFC Layout Debugger makes Block Formatting Contexts visible. Toggle a BFC on and off in three classic scenarios: a parent collapsing around floated children, two margins collapsing into one gap (with a live pixel measurement), and text wrapping under a float versus forming its own column. It is free and runs fully in your browser.

The BFC is one of CSS layout's most misunderstood ideas, yet it explains so many real bugs: the collapsed parent, the margin that refuses to add up, the text that slides under a floated image. Seeing the before and after side by side, with the exact CSS that creates a BFC (display: flow-root, overflow: hidden, and friends), turns a vague concept into a debugging tool you will actually use.

Frequently asked questions

Popular searches

bfc cssblock formatting contextblock formatting context explainedcss bfc visualizerdisplay flow-rootdisplay flow-root vs overflow hiddencss float parent collapseparent div not wrapping floatsclearfix vs flow-rootcss margin collapsemargins not adding up cssprevent margin collapse cssmargin collapse bfccss float text wraptext wrapping under floatoverflow hidden creates bfcwhat creates a bfcbfc triggers listcss layout debugginglearn css layoutcss bfc examplesblock formatting context tutorialcss float containmentclear floats csscss bfc interactivevisualize margin collapsecss margin 40px 40px 40px gapwhy do margins collapsecss bfc mdnflow-root browser supportcss contain layoutbfc vs stacking contextcss formatting contextinline formatting contextcss float exclusionfloat intrusion csscss layout conceptscss box model deep divefrontend interview bfccss bfc interview questionmargin collapsing rulesnegative margin collapsecss bfc tool freecss debugger onlinelearn css floatscss float layout explainedblock formatting context demobfc css margin collapse fixwhat creates a bfc in cssbfc overflow hidden explained

More tools

Coming soon

CLI

Coming soon

Figma plugin

Coming soon

VS Code extension

Coming soon

Chrome extension

Coming soon

AI icon generator

Coming soon

Team workspaces

Coming soon

View all 10+ tools →