IoU Calculator
Intersection over Union for two axis-aligned boxes.
About this tool
Enter two boxes by their top-left (x1, y1) and bottom-right (x2, y2) corners and get the Intersection over Union: overlap area divided by combined area. It is the standard metric for object detection.
How to use
How it works
IoU = area(A ∩ B) / area(A ∪ B), where the union is area A + area B − intersection. It runs from 0 (no overlap) to 1 (identical boxes). Detection benchmarks often count a prediction as correct when IoU is at least 0.5.
IoU = |A ∩ B| / (|A| + |B| − |A ∩ B|)
Worked example
Two overlapping squares
- Input
- A = (0, 0, 2, 2); B = (1, 1, 3, 3)
- Output
- IoU 0.142857; intersection 1; union 7
- Walkthrough
- Each box has area 4. They overlap in a 1 × 1 square, so the union is 4 + 4 − 1 = 7 and IoU = 1/7. Boxes (0,0,1,1) and (2,2,3,3) give 0.
Limitations
- Axis-aligned boxes in corner format only; width and height input is not supported.
- Rotated boxes and segmentation masks are not handled.
- Coordinates are used as given, so mix of units or pixel and normalised values give wrong answers.
Questions
How do I calculate IoU?
What IoU threshold is typical?
What are the box coordinates?
What IoU do non-overlapping boxes have?
Features
- Intersection and union
- Corner coordinates
- Runs in your browser
Related resources
Guides and videos from around the web—opens on YouTube or the publisher’s site.
TensorFlow 2.0 Complete Course
freeCodeCamp.org
Practical ML stack context next to AI utilities.
Watch on YouTubeMachine Learning for Everybody
freeCodeCamp.org
Accessible ML survey for AI calculator and metric tools.
Watch on YouTube
- Machine Learning Crash Course
Google Developers
Official ML crash course pairing with metric calculators.
- DeepLearning.AI
DeepLearning.AI
Courses and explainers for modern AI tooling.