# Diagram boxes too close or overlapping: how to fix it

The message means two blocks sit closer than 16 px, the theme's `min_gap`, or that one covers part of the other.


```json
{"title": "Bookshop orders",
 "gap": 10,
 "columns": [[{"id": "shop", "title": "Online shop", "tiles": ["Basket", "Checkout"]}],
             [{"id": "orders", "title": "Order service", "tiles": ["Orders", "Stock"]}]],
 "links": [{"from": "shop", "to": "orders"}]}

```

![Bookshop orders](https://open-diagram.dev/images/pages/problems-boxes-too-close-1.svg)

The check: 1 layout problem(s)

```text
'shop' and 'orders' are only 10 px apart (minimum 16)
```


## Why does it happen?

A spacing setting or a position set by hand has put two blocks too close:

- `gap` or `row_gap` set under 16. Left out, columns sit 72 px apart and rows 28 px.
- `x` and `y` in the `panels` layout, or `add()` in Python.

Here the cause is `"gap": 10`. The check measures the space between every pair of blocks and reports each pair under 16 px on its own line. It names each block by its `id`, or by its title when it has none. When one block covers another, the message reads `'shop' and 'orders' overlap; move one (right_of() and below() keep a gap)`.

## How do I fix it?

Give the two blocks at least 16 px between them.

1. If you set `gap` or `row_gap`, raise it to 16 or more. In Python, both are arguments of `columns()`.
2. If you placed the blocks with `x` and `y`, move one of them.
3. In Python, place the second block with `right_of()` or `below()`, which keep the theme's gap.
4. Run the check again.

With `gap` at 40, the check reports 0 layout problems:


```json
{"title": "Bookshop orders",
 "gap": 40,
 "columns": [[{"id": "shop", "title": "Online shop", "tiles": ["Basket", "Checkout"]}],
             [{"id": "orders", "title": "Order service", "tiles": ["Orders", "Stock"]}]],
 "links": [{"from": "shop", "to": "orders"}]}

```

![Bookshop orders](https://open-diagram.dev/images/pages/problems-boxes-too-close-2.svg)

The check: 0 layout problems

Updated November 25, 2026. Web page: https://open-diagram.dev/problems/boxes-too-close.html

See also:

- [Diagram line crosses a box: how to fix it](https://open-diagram.dev/problems/line-crosses-a-box.md)
- [Diagram group covers a box that is not in it: how to fix it](https://open-diagram.dev/problems/group-covers-a-box.md)
- [Text does not fit in a diagram box: how to fix it](https://open-diagram.dev/problems/text-does-not-fit.md)
