TechnSols
Advertisement

Pixel Collision Detector

Test pixel-perfect collision online free with Pixel Collision Detector. Overlap count and preview for two sprites, no install or sign-up needed.

Be the first to rate this tool

Use the demo sprites or upload two sprites, set the offset, then press Test Collision.

What Is Pixel Collision Detector?

Pixel Collision Detector is a free online tool by TechnSols that tests pixel-perfect overlap between two game sprites. It counts the exact pixels where both sprites are solid at the same place, and reports that count, the overlap as a percentage, and a preview with the shared pixels highlighted in yellow. The demo sprites are already loaded, a blue circle and a red square, so you can test with one click and no files.

Advertisement

Most games first test collision with bounding boxes, which are plain rectangles around each sprite. That test is fast, but it is also wrong for any sprite that is not a rectangle: a round ball or a diagonal sword will report hits where nothing solid was touched. Pixel-perfect testing fixes that by looking at the actual opaque pixels, so a hit only counts when solid art meets solid art. The live Image to JPG tool converts a sprite in the browser before you upload it here.

Everything runs in your browser, and no file is uploaded anywhere. The sprites stay on your screen, and nothing about your game art is stored or shared.

How To Use Pixel Collision Detector?

Using Pixel Collision Detector takes about a minute, with nothing to install and no account to make. The demo sprites are a blue circle with 5024 opaque pixels and a red square with 6400 opaque pixels, both in 120 by 120 frames. Move sprite B with the sliders, press Test Collision, and read the count. The JSON Formatter tool shows structured data in a tidy layout.

Step 1: Start With The Demo Sprites Or Upload Yours

Open the page and the two demo sprites are waiting: sprite A is a blue circle, radius 40, centred at (60, 60), and sprite B is a red square, 80 by 80 at (20, 20). To use your own art, upload a PNG, JPG, or WebP file for sprite A, sprite B, or both. Each file is checked by its extension and its magic bytes before anything is drawn, and files over 100 MB are refused. An uploaded image is drawn to fit the same 120 by 120 frame.

Step 2: Set The Offset For Sprite B

Move sprite B with the X and Y sliders, from minus 120 to plus 120 pixels, or type the exact numbers in the boxes beside them. The preview updates at once. At offset (0, 0) the whole circle sits inside the square, and the overlap is the full 5024 pixels. At offset (+40, 0) the overlap falls to 2512 pixels.

Step 3: Test The Collision And Download The Result

Press Test Collision and read the status line, which states whether the sprites collide, the overlapping pixel count, and the overlap percentage. The result panel repeats the figures with both opaque pixel counts, and the preview paints the shared pixels in yellow. The file row shows the TXT result with a preview thumb, and the Download button saves it. A fully separated offset gives 0 overlapping pixels. For sprite art saved as PNG, the PNG to JPG tool converts it when a smaller file is needed.

Why Do Bounding Boxes Miss Hits That Pixels Catch?

A bounding box is a promise that the sprite fills its rectangle, and most sprites break that promise. A circle fills only about three quarters of its box, and a character with outstretched arms leaves big empty corners. Every empty corner is a place where the box test says hit and the player sees a miss, and every such miss chips away at trust in the game.

Pixel-perfect testing costs more time than a box test, so it is used as the second step, not the first. The game checks the cheap boxes first, and only when the boxes overlap does it pay for the pixel scan. That two-step pattern is fast where nothing touches and exact where something might. The Image to WebP tool makes a lighter WebP copy in the browser.

Round Sprites Waste Their Corners

A round sprite inside a square box wastes the four corners, and those corners are where false hits live. A bullet that clips the corner of the box still counts as a hit in a box-only game. The pixel test ignores those corners, so the bullet must strike the ball itself. The demo pair shows it: the circle has 5024 opaque pixels inside a 14400 pixel frame, and the other 9376 pixels are empty air that a box test would wrongly count.

Transparent Gaps Should Never Count As Hits

A sprite with a hole in it has transparent pixels in the middle that are part of the design. A box test cannot see the hole, so it reports a hit when a shot passes through the centre. The pixel test reads the alpha channel and only counts pixels where both sprites are opaque. A shot through the hole scores 0. If the sprite is too large to see whole, the Image Resizer tool scales it down before you upload it.

A Broad Check First Keeps The Test Fast

Scanning every pixel of two sprites on every frame would be slow, so the test starts with the cheap bounding-box check. If the boxes do not overlap at all, the answer is 0 at once, with no pixels read. Only when the boxes meet does the tool scan the shared rectangle and count the places where both alphas are above zero. That is why a fully separated offset returns 0 instantly.

What Can You Do With Pixel Collision Detector?

Pixel Collision Detector fits any 2D game where the shape of the art matters more than the shape of its box. These are the jobs it handles best.

Prove A Bullet Hit A Round Target

A bullet against a round target is the classic pixel test. Place the target as sprite A and the bullet as sprite B, move the bullet to the point of impact, and test. If the bullet clips the corner of the target box but misses the circle, the count is 0, and the box test alone would have lied. If the bullet strikes the circle, the count tells you how deep the hit was, which grades a graze against a solid strike. The Image Size Changer tool scales a sprite to exact pixels.

Check A Character Against A Hazard

A character walking past spikes, lava, or a swinging blade needs a test that respects the shape of both sides. The hazard is rarely a rectangle, and the character is never one either, so a box test would hurt the player for standing near a spike that never touched them. Test the pair at the closest approach: a count of 0 means the player slipped past safely, and a small count means only a toe brushed the hazard. That number is the fairest way to tune how close is too close.

Measure How Much Two Sprites Overlap

Sometimes the question is not whether two sprites touch, but how much. A healing aura or a splash zone grows stronger as the overlap grows, and the pixel count is the honest measure. The percentage is measured against the smaller sprite, so 100.0 percent means it is fully covered, and 50.0 percent means half of it is covered. The demo pair shows both ends: 5024 pixels at offset (0, 0) is 100.0 percent, and 2512 pixels at offset (+40, 0) is 50.0 percent.

Every job ends the same way: a count, a percentage, and a highlighted preview that shows exactly where the sprites meet.

Advertisement

Quality And Settings

Five settings shape the test, and each one is simple to set.

  • Sprite frames: fixed at 120 by 120 pixels each, with the demo circle and square drawn in code and any uploaded image scaled to fit.
  • Sprite A: the blue circle demo, 5024 opaque pixels, or an uploaded PNG, JPG, or WebP image in its place.
  • Sprite B: the red square demo, 6400 opaque pixels, or an uploaded PNG, JPG, or WebP image in its place.
  • Offset X and Y: sliders and number boxes from minus 120 to plus 120 pixels, both starting at 0.
  • Overlap percentage: measured against the smaller sprite’s opaque pixel count, shown with one decimal place.

The 120 by 120 frame keeps the scan fast: at most 14400 pixels are checked per test, so the answer appears at once. Larger sprites are scaled to fit. When the result must feed another format, the JSON Validator tool checks structured data before it is used.

How Pixel Collision Detector Counts Overlapping Pixels

The detector starts with the cheap bounding-box check: if the two 120 by 120 frames do not overlap at the chosen offset, the answer is 0 with no pixels read. When the frames do overlap, it works out the shared rectangle and scans it, reading the alpha value of each sprite there. A pixel counts only when both alphas are above zero, which means both sprites are solid at that exact place. The count is the number of such pixels, and the percentage divides that count by the smaller sprite’s opaque pixel count. The preview paints every counted pixel in yellow, so the overlap is visible as well as numbered. The Image to Base64 tool turns a sprite into text when a game loads art from code.

Two honest limits are worth knowing. First, the test counts opaque-pixel overlap only: it does not know about rotation, scaling, or speed, so a spinning or fast sprite needs its own checks in the game. Second, a JPG has no transparency, so an uploaded JPG counts as fully opaque across its whole frame, and only PNG or WebP uploads keep real transparent pixels.

Privacy

Everything you test stays in your browser. Pixel Collision Detector runs on your own computer, and nothing you upload is sent to a server, stored, or shared with anyone. The tool draws the sprites and counts the pixels locally, and that is all it does.

Because no account is needed, there is no name, email, or history tied to what you do. Closing the tab ends the session, and the browser clears the sprites and the result from memory. Your game art stays yours.

Tips

A few habits make Pixel Collision Detector work smoother.

  • Start from the demo pair to learn the sliders before uploading your own art.
  • Trim transparent borders from a sprite first, so the frame holds art.
  • Use PNG or WebP uploads when transparency matters, because JPG has none.
  • Move sprite B one step at a time to find where the count first rises above 0.
  • Save the TXT result for each test, so tuning changes can be compared.

When the count is 0 the sprites miss, and when it rises the sprites meet. The Random Number Generator tool picks random offsets inside any range you set.

More Tools For The Same Job

These tools handle the same kinds of jobs: sprites, grids, levels, and game data.

FAQ

Common questions about pixel-perfect collision and this detector, answered plainly.

Is Pixel Collision Detector By TechnSols Free?

Yes, Pixel Collision Detector by TechnSols is completely free to use, with no account, no sign-up, and no usage limit. You can test as many sprite pairs as you like, and everything runs in your browser, so nothing is uploaded or stored anywhere.

What Do The Demo Sprites Give At Offset Zero?

At offset (0, 0) the demo pair gives 5024 overlapping pixels, which is 100.0 percent of the smaller sprite. The blue circle has 5024 opaque pixels and sits fully inside the red square. Move sprite B by 40 pixels and the count falls to 2512.

Can I Upload My Own Sprites?

Yes, upload a PNG, JPG, or WebP image for sprite A, sprite B, or both, and each one replaces its demo sprite. The file is checked by extension and magic bytes first, and files over 100 MB are refused. Use PNG or WebP when transparency matters, because a JPG has no transparent pixels.

How Does The Tool Read Pixel Transparency?

The tool draws each sprite to an off-screen canvas and reads its pixels with getImageData, which returns the red, green, blue, and alpha value of every pixel. A pixel counts as solid when its alpha is above zero, and as overlap only when both sprites are solid there. The getImageData guide explains how browsers expose canvas pixels.

Why Is A Pixel Test Slower Than A Box Test?

A box test compares four numbers, while a pixel test reads thousands of pixels, so it costs ten to twenty times more time. Games check boxes first and only scan pixels when the boxes already overlap. A Collision Detection overview explains the broad and narrow phases used by real games.

Move the offset, test the pair, and read the count. A hit that counts real pixels is a hit the player can trust.

Follow TechnSols on Google
Add TechnSols as a preferred source to see more of our tools in Google Search.
Add to Preferred Sources
Advertisement