What Is a Hitbox in Video Games? Boxes You Cannot See
If you have ever asked "what is a hitbox in video games?", the short answer is this: a hitbox is an invisible shape the game uses to decide whether two things touch. The art is for your eyes; the hitbox is what the rules check.
This guide explains how hitboxes work, why they rarely match the pictures, and what that means for how a game feels. The examples come from Tank City Reboot, a free tank game that plays in your browser.
What is a hitbox in video games?
A hitbox is a simple shape attached to an object, such as a tank, a bullet or a wall. The game compares shapes, not pictures. When two shapes overlap, the game says "a hit happened" and runs the rule that goes with it: lose a life, destroy the enemy, stop the shot.
The shape is almost always simpler than the art. A tank sprite with treads and a cannon becomes a plain square. That is on purpose: checking two squares is fast, while checking every pixel of two drawings is slow and gives odd results.
How a hitbox works behind the scenes

Every frame, the game moves things and then asks, "does any shape overlap another?" For boxes, the question is two small comparisons: are they close enough on the horizontal axis, and close enough on the vertical axis? If both answers are yes, the boxes overlap.
Tank City Reboot uses exactly this. In the first game, a tank is a 16 by 16 box. Two tanks overlap when they are less than 16 pixels apart on x and also less than 16 pixels apart on y.
Here is a worked example. Say your tank sits at x 100, y 50, and an enemy sits at x 110, y 60.
- Distance on x is 10, which is under 16.
- Distance on y is 10, which is under 16.
- Both are under 16, so the boxes overlap and the tanks cannot occupy that spot.
Now move the enemy to x 120. The distance on x is 20, so there is no overlap even though y is still 10. One clear axis is enough.
In the first game, tanks move one pixel at a time and stop flush against walls and other tanks. That is why a tank can sit snug against a wall with no gap and no overlap. A tank that already overlaps another is still allowed to move away, so nothing gets stuck.
Hitbox vs hurtbox: what is the difference?
Many games split the idea in two. A hurtbox is the area that can take damage. A hitbox, in the stricter sense, is the area that deals it, like a punch or a bullet. Wikipedia's hitbox page notes that the terms are not standardized: some games swap them, and many only use "hitbox" for both sides.
The split matters when the two shapes differ. A fighting game character might have a large attack box and a smaller body box. A bullet in a shooter has a tiny damage area, and the enemy it hits has a bigger body area.
Tank City Reboot shows this split well. A shot counts as a 4 by 4 box, and a tank as a 16 by 16 box. The shot does the hitting, and the tank can be hurt. The target is wide and the shot is narrow, and that is part of how aiming feels.
Common hitbox shapes: rectangles, circles, and more
Most games pick from a short list.
- Rectangles. Cheap to check and a natural fit for grid-based games. Both Tank City games use boxes.
- Circles. Good for round things, since a circle has no corners to catch on.
- Several shapes combined. A head, a body and legs each get their own box, so a game can tell where you were hit.
A box has corners, and corners are where players clip walls or get clipped by shots. Designers often shrink the box or nudge things to make corners less painful.
Why hitboxes decide whether a game feels fair
Players judge fairness by what they see. If a shot looks like it passed through empty space and still hurt, the game feels cheap. Hitboxes sit in the gap between what you see and what the rules check. A box slightly smaller than the art, when the player is the target, makes a near miss count as a miss, which feels like skill.
Tank City Zero Day does this. Its tank boxes are drawn 16 pixels wide but collide as 14. You get two pixels of mercy around the edges. Zero Day also lets a tank that is blocked head-on try shifting sideways, up to 6 pixels, so you slide around a corner instead of snagging on it. Neither trick shows on screen, but both make steering feel smoother. The shots are not as kind: a shot hits the full 16 pixel box.
Fairness applies to levels too. If that interests you, read how games make sure a level can be beaten.
Hitboxes in shooting games: bullets, tanks, and walls
Shooting games stack many collisions: shot against tank, wall or shot, and tank against tank. Each can follow its own rule.
Speed and the skipped-hit problem
A fast, small shot can jump over a thin object between two frames. Games avoid this by moving the shot in small steps and checking at each step. In both Tank City games, a shot moves at most 2 pixels per check. With 16 pixel tanks, a shot cannot hop over one unnoticed. For more on how fast shots travel, see what projectile speed is in shooting games.
Shots that cancel shots
In both games, one of your shots and an enemy shot cancel each other when they come within 4 pixels. That is a hitbox rule between two bullets, and it gives you a way to defend yourself by firing back.
Different walls, different rules
Not every solid thing blocks every other thing. In both games, coolant blocks tanks but lets shots fly over it. Firewall and silicon block shots. Encrypted zones hide a tank inside them but do not stop shots. One tile can have one rule for tanks and a different rule for shots.
The dash: a hitbox you can switch off
In Tank City Zero Day, your dash lasts 0.2 seconds, and you cannot be hit during it. The game does not move your box away. It simply refuses to count a hit on you for that fifth of a second, and the shot flies on. That is why the game says you can dash straight through enemy fire.
Big targets and many shots
Bosses get bigger boxes. The zero-day boss in Zero Day is a 32 pixel box, twice the width of a tank, with 40 hit points on wave 5. The Multithreading upgrade fires several shots in a spread, each with its own small box: two shots at plus and minus 6 degrees at level 1, and five shots from minus 20 to plus 20 degrees at the top. See what a spread shot is.
How designers tune hitboxes (and why they sometimes cheat)
Designers rarely leave hitboxes at the size of the art. They adjust them until the game feels right, often in the player's favour.
- Shrink the player's box. Zero Day's 14 pixel collision on a 16 pixel tank is one example.
- Add corner help. Zero Day's sideways shift of up to 6 pixels removes the sticky corner.
- Grant a safe moment. A new tank takes 0.9 seconds to arrive in the first game and 0.6 in Zero Day, and it can be neither moved nor hit meanwhile. It then has a shield, 3.9 seconds in the first game and 2.5 seconds in Zero Day.
- Make threats readable. A big boss box and ring-shaped shot patterns, like the cryptominer's rings of 8 shots, let you see where the gaps are.
The tuning is a test-and-adjust job. You change a number, play it, and decide whether a death felt earned. To feel one of these numbers, squeeze a tank past a wall in the first game, then try Zero Day and notice how much easier the corners are.
Frequently asked questions
Can you see a hitbox in a game?
Usually not. Hitboxes are invisible by default. Some games have a debug mode that draws them, but you will not see one in normal play.
Is a hitbox the same as the character model?
No. The model is what you see, and the hitbox is a simpler shape the game uses for its checks. They often differ by a few pixels, and that gap is on purpose.
Why do I get hit when a shot looks like it missed?
The game checks boxes, not drawings, so a shot can overlap the box before it seems to touch the art. Motion also plays a part: shots move in small steps, and a box can overlap between two frames. Glow and effects around a sprite can make a near miss look closer than it was.
What is a hurtbox?
A hurtbox is the area that can take damage. A hitbox, in the strict sense, is the area that deals it, though many people use "hitbox" for both.
Get started with Tank City Reboot
The best way to understand a hitbox is to play with one. Aim a shot at a 16 pixel tank, slip past a corner, and dash through a volley in Zero Day. You will feel the rules at work.
Play Tank City Reboot: it is free, plays in your browser on a computer or a phone, and needs no account.
Comments
No comments yet.
Sign in or make an account to comment.