2D Collision Tester
Test whether two axis-aligned rectangles overlap, with the overlap area and a scaled SVG diagram.
What the page computes
Computes whether two axis-aligned rectangles overlap and draws both to scale as an SVG diagram. It reports the overlap width, height and area, or the gap on each axis when they miss.
What it does not do
It is an axis-aligned box test only, so rotated shapes, circles and pixel-perfect sprites are approximated by their bounding box. Each box must have a positive width and height, and a zero-size box is refused because it covers no ground.
Why a reload prints the same answer
Everything runs in this tab with JavaScript: no request is made, no account is needed and nothing is stored, so the same inputs print the same lines after a reload.
Computes whether two axis-aligned rectangles overlap and draws both to scale as an SVG diagram. It reports the overlap width, height and area, or the gap on each axis when they miss.
How to use it
Type the x, y, width and height of both boxes in whatever unit you are using, then press Run. Box A is drawn in blue, box B in amber and the overlap in red, and the diagram title repeats the verdict.
The arithmetic
The overlap on one axis is min(ax+aw, bx+bw) - max(ax, bx), and the same for y. A collision needs both values strictly positive, so touching edges are reported as a miss rather than a one-pixel hit.
What to Expect
Best for
- game developers checking hit boxes
- a quick check before or during a session
What this tool keeps
- Runs entirely in this browser tab, with no upload.
- Every figure is printed with the inputs that produced it.
Frequently asked questions
How do I use the 2D Collision Tester?
Type the x, y, width and height of both boxes in whatever unit you are using, then press Run. Box A is drawn in blue, box B in amber and the overlap in red, and the diagram title repeats the verdict. The printed lines replace the previous answer.
Is anything uploaded?
No. The arithmetic runs in this tab with JavaScript: no request is made, no account is needed and nothing is stored, so the page keeps working offline once loaded.
What are its limits?
It is an axis-aligned box test only, so rotated shapes, circles and pixel-perfect sprites are approximated by their bounding box. Each box must have a positive width and height, and a zero-size box is refused because it covers no ground.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.