IoU Calculator — Intersection over Union
Compute Intersection over Union for two bounding boxes or two label sets. Get IoU, the Dice/F1 coefficient, the raw intersection and union, a threshold pass/fail verdict, and a scaled overlap diagram — instantly, in your browser, with sources cited.
How it works
Intersection over Union (IoU) is the standard way to measure how well two regions overlap. In object detection it scores a predicted bounding box against the ground-truth box; in segmentation and classification it compares two sets of pixels or labels. The value is always between 0 (no overlap) and 1 (perfect overlap).
Bounding-box mode follows the PASCAL VOC overlap criterion. Boxes are handled in corner form x1, y1, x2, y2 (the x, y, w, h format is normalised first as x2 = x + w, y2 = y + h). The intersection rectangle is found by taking the inner edges:
- ix1 = max(Ax1, Bx1), iy1 = max(Ay1, By1)
- ix2 = min(Ax2, Bx2), iy2 = min(Ay2, By2)
- inter = max(0, ix2 − ix1) × max(0, iy2 − iy1)
The max(0, …) clamps disjoint boxes to a zero intersection rather than a negative area. Each box area is its width times its height, the union is areaA + areaB − inter, and finally IoU = inter / union. The Dice/F1 coefficient is 2·inter / (areaA + areaB), equivalently 2·IoU / (1 + IoU)— this page computes Dice both ways and confirms they agree, the credibility check behind the “verified” note.
Label-set mode computes the Jaccard index, which is IoU on sets: tokens are lower-cased and de-duplicated into sets A and B, then IoU = |A ∩ B| / |A ∪ B| and Dice = 2·|A ∩ B| / (|A| + |B|). This is the right metric for comparing predicted and true class labels, multi-label tags, or any two collections.
A detection is counted as a match when IoU ≥ the threshold. The 0.5 default is the PASCAL VOC convention; the COCO benchmark instead averages results across thresholds 0.50 to 0.95, which is why the calculator also shows the verdict at 0.50, 0.75, and 0.95 so you can see how a single pair fares across the COCO range.
Worked examples
Frequently asked questions
Sources & references
- Everingham et al., 2010 — The PASCAL Visual Object Classes (VOC) Challenge (IJCV) — defines the IoU > 0.5 detection criterion
- COCO — Detection Evaluation — mAP averaged over IoU thresholds 0.50:0.05:0.95
- Jaccard, P. (1912) — The distribution of the flora in the alpine zone (New Phytologist) — the Jaccard index
- Dice, L.R. (1945) — Measures of the Amount of Ecologic Association Between Species (Ecology) — the Dice coefficient
The formulas and thresholds on this page were last cross-checked against these sources on 2026-06-10. Worked examples are reconciled by hand in the calculator's source module and re-run whenever the implementation changes.
Related tools
Comments & feedback
Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.
Found a box that scored wrong, an edge case, or want polygon / rotated IoU added?
Email me at [email protected] — most fixes ship within 24 hours.