How Big Should a 2D Hitbox Be?
Starting sizes for 2D body colliders, hurtboxes and attack hitboxes, why they differ, which shapes to use in Godot, Unity and GameMaker, and how to tune.
Players forgive a lot, but they do not forgive dying to a spike that clearly missed. Most "unfair" moments in 2D games are not bugs in the physics. They are boxes that are the wrong size for their job.
There is no single right hitbox size because a character has at least three boxes, and each one should be sized differently. The body collider that touches floors and walls should be narrower than the art, roughly 50 to 70 percent of the visible body width. The player's hurtbox, the area that takes damage, should be a little smaller than the visible body. The player's attack hitbox should be a little larger than the weapon swing looks. Enemy attacks go the other way: slightly smaller than they look. Every bias favors the player.
Those are starting points. The rest of this guide gives concrete ratios, a real shipped example, shape choices for Godot 4, Unity and GameMaker, and a tuning routine.
Three boxes, three jobs
| Box | Job | Touches | Lives on |
|---|---|---|---|
| Body collider | Stands on floors, stops at walls, pushes crates | World geometry | The physics body (Godot CharacterBody2D, Unity Rigidbody 2D object, GameMaker instance mask) |
| Hurtbox | Receives damage | Enemy attacks, hazards, projectiles | A detection area on the character |
| Attack hitbox | Deals damage | Other characters' hurtboxes | A detection area that is active only during attack frames |
| Interaction area (optional) | Picks up items, opens doors, talks to NPCs | Pickups, triggers | A detection area, usually larger than the body |
Keeping these separate is the most important decision in this guide. If one box does everything, you cannot make the character slip past ledges, survive near-misses and land generous sword hits at the same time. The difference between the last three is covered in the companion post on hitbox vs hurtbox; here the focus is size.
Measure against the visible body, not the cell
Before you pick any ratio, decide what you are measuring. Use the visible body: the solid silhouette of torso, head and legs, ignoring hair, capes, weapon tips and loose cloth. Do not size against the sprite cell.
Cells include padding and change with pose. On one character measured across six baked sheets, cell height was 260 px on every sheet but cell width ranged from 119 px in idle to 221 px in a celebration pose. A box sized as a percentage of the cell would grow and shrink with every animation. A box sized to the body stays put.
Measure once, on the neutral frame of your reference animation (usually idle), and keep those numbers for every animation.
Starting sizes
These ratios are a starting point for playtesting, not a standard. Treat them as the first value you type, then tune.
| Box | Width | Height | Position |
|---|---|---|---|
| Body collider (side view) | 50 to 70 percent of visible body width | From the feet to roughly the top of the head, minus hair | Bottom edge exactly at the feet (the pivot) |
| Body collider (top-down) | 50 to 70 percent of body width | Only the footprint: roughly the bottom 20 to 30 percent of the character | Centered on the feet |
| Player hurtbox | 70 to 90 percent of the body collider's width | Skip the top of the hair and the bottom few pixels of the feet | Inside the body collider |
| Player attack hitbox | The weapon's swept area plus a few pixels | Same | In front of the character, active only on hit frames |
| Enemy hurtbox | About the size of the visible body | Same | Generous: hits that look like hits should land |
| Enemy attack hitbox | Slightly smaller than the visible attack | Same | Near-misses should miss |
| Pickup or interaction area | 120 to 150 percent of the pickup's art | Same | Centered on the pickup |
Why narrower bodies? A body collider as wide as the art catches on every ledge corner and doorway. Trim the sides and the character slips into gaps the player expects it to fit, and stands on edges the way the art suggests.
Why a smaller player hurtbox? Players judge danger by the character's solid shape. A fireball that grazes the hair or a cape tip and kills the player feels like cheating, even when the pixels overlapped.
A real example: Celeste's player boxes
Celeste's developers published the source of the game's player class as a learning resource, which makes it one of the few shipped games where you can read the exact numbers. The game uses a small pixel-art character, and it keeps the same separation of body and hurtbox described above:
| Box in Celeste's Player.cs | Width x height (px) | Offset from origin (x, y) | Notes |
|---|---|---|---|
| Normal hitbox (body) | 8 x 11 | (-4, -11) | Spans from 11 px above the origin down to the origin |
| Normal hurtbox | 8 x 9 | (-4, -11) | Same top, but ends 2 px above the feet |
| Duck hitbox | 8 x 6 | (-4, -6) | Swapped in when crouching |
| Duck hurtbox | 8 x 4 | (-4, -6) | Again ends 2 px above the feet |
| Star fly hitbox | 8 x 8 | (-4, -10) | Special movement state |
| Star fly hurtbox | 6 x 6 | (-3, -9) | 1 px inside the hitbox on every side |
Three lessons in one table:
- The body box's bottom is the origin, and the origin is the feet. The offset of -11 with a height of 11 puts the box's bottom edge at y = 0. That is the bottom-center pivot rule from sprite pivot points applied to collision.
- The hurtbox is smaller than the body box. Two pixels at the feet are not hurtable, so brushing the top of a spike row does not kill.
- Crouching swaps boxes instead of scaling one. Each state has its own predefined box.
The same file sets a jump grace time of 0.1 seconds, letting the player jump briefly after leaving a ledge. Forgiveness is not only spatial.
A worked example at a larger scale
Say your character is drawn 230 px tall from feet to head, the height Cal Voss was sized to in Wayfarer's Hearth, and the visible body is about 80 px wide at the shoulders. Here is a first pass for a side-view action game:
| Box | Starting size | How it was derived |
|---|---|---|
| Body collider | Capsule, 52 px wide, 215 px tall | 65 percent of 80 px; full height minus hair |
| Hurtbox | Rectangle, 44 px wide, 190 px tall, bottom edge 8 px above the feet | About 85 percent of body width; skips the hair and soles |
| Sword hitbox | Rectangle covering the blade's arc plus 6 px | Active on the frames where the blade is extended |
| Pickup area on items | 1.3 times the item's art | Easy to collect while moving |
Then playtest and adjust. If the numbers feel too generous or too strict, change one box at a time.
If your engine uses world units instead of pixels, convert first. In Unity, divide by your Pixels Per Unit: at PPU 100, a 52 px wide capsule is 0.52 units. Pixels per unit, explained covers that conversion.
Platformer, top-down and brawler placement
The ratios change less than the placement does.
| Game type | Body collider | Hurtbox | Attack hitbox |
|---|---|---|---|
| Side-view platformer | Tall, narrow, bottom at the feet | Inside the body, trimmed at head and feet | Small, short-lived |
| Top-down adventure or RPG | Small footprint at the feet only | Covers the visible body above the footprint | In the facing direction |
| Side-view brawler or fighter | Narrow, used for pushing apart | Several boxes per frame matching limbs | Several boxes per frame matching the strike |
| Shoot 'em up | Not used, or tiny | Very small, often a few pixels at the ship's core | Bullets sized to their art or a little smaller |
Top-down games are the case people get wrong most often. If the body collider covers the whole sprite, characters cannot walk up to a table or behind a pillar without bumping into empty air. Make the body collider the footprint, and let draw order handle the overlap.
Choose the right shape
| Shape | Godot 4 | Unity | GameMaker mask | Best for |
|---|---|---|---|---|
| Rectangle | RectangleShape2D |
Box Collider 2D | Rectangle | Hurtboxes, attack hitboxes, tile-based bodies |
| Capsule | CapsuleShape2D |
Capsule Collider 2D | (none; use rectangle or ellipse) | Character bodies that should slide off corners and slopes |
| Circle | CircleShape2D |
Circle Collider 2D | Ellipse | Projectiles, round pickups, top-down footprints |
| Polygon | CollisionPolygon2D or ConvexPolygonShape2D |
Polygon Collider 2D | Precise | Irregular static scenery, rarely characters |
A few engine details that matter:
- Godot: shapes are resources on a
CollisionShape2Dor drawn withCollisionPolygon2D. Godot's physics docs warn never to scale collision shapes: keep the node's Scale at (1, 1) and resize with the shape's size handles. A capsule's height includes both rounded ends and must be at least twice its radius. - Unity: the 2D collider family is Box, Circle, Capsule, Polygon, Edge, Composite and Custom. Edge colliders are open lines, which suit one-way platforms and terrain outlines but not character bodies.
- GameMaker: a sprite's collision mask can be rectangular, rotated rectangle, ellipse, diamond or precise. The manual notes that non-rectangular shapes cost more processing during collision checks, and when two instances have different mask kinds the check falls back to precise.
The default rule: rectangles and capsules for anything that moves, polygons only for things that do not.
Keep the body box stable across animations
A body collider that changes shape every frame makes characters jitter, catch on floors and fall through thin platforms. Keep one body box per movement state (standing, crouching, rolling) and swap between them, as Celeste does.
In GameMaker this means being careful with per-frame masks. sprite_collision_mask has a sepmasks argument that generates a separate mask for every frame. That is useful for precise attack shapes, but for a body you want one stable mask. Assign a dedicated mask sprite through mask_index, for example a plain rectangle sprite, so the body collision ignores the animation entirely.
In Godot and Unity, do not animate the body collider's size. If you need a different box for crouching, keep two shapes and enable one at a time.
Attack hitboxes are the exception: they are meant to change per frame. That is a timing question covered in the next post in this cluster.
Tune by playtest
- Turn on debug drawing. Godot: Debug > Visible Collision Shapes. Unity: select the object and view its collider outlines in the Scene view. GameMaker: draw the bounding box in a debug Draw event.
- Test the edges. Walk off every ledge, into every doorway, under every low ceiling. Widen or narrow the body box until movement matches what the art suggests.
- Test near-misses. Jump over hazards with a pixel to spare. If the player dies on misses that look clean, shrink the hurtbox.
- Test your own attacks. Swing at enemies at the edge of the weapon's reach. If hits that look good miss, grow the attack hitbox.
- Watch someone else play. The complaints "that should have hit" and "that missed me" tell you which box to change.
- Write the final numbers down in a table per character so later characters can follow the same rules. Clear silhouettes help here too: players read danger from shape, which character silhouette differentiation covers.
If the character appears to sink into the floor while you are tuning, the body box bottom is not at the feet. Why your character sinks into the floor walks through that fix.
Doing this in Makko
In Code Studio, the Asset Manager right-sizes characters against a reference animation and anchors them bottom center, so every character in the cast shares a pixel scale and a foot line. That means one table of hitbox ratios applies to the whole cast.
You can @-mention a character asset in the AI code assistant and ask it to add a body collider, a hurtbox and an attack hitbox at the sizes in your table, then check the result with your engine's debug view. You stay human-in-the-loop where you want to be: the assistant writes the setup, you tune the numbers by playing.
FAQ
How big should a hitbox be compared to the sprite?
Size it against the visible body, not the sprite cell. A good starting point is a body collider at 50 to 70 percent of the body's width, a player hurtbox a little smaller than that, and a player attack hitbox a little larger than the weapon swing looks. Tune from there by playtesting.
Should the player's hurtbox be smaller than the sprite?
Yes, in most action games. Players judge hits by the character's solid shape, so grazes on hair, capes or the very bottom of the feet feel unfair. Celeste's published player code, for example, ends the hurtbox 2 px above the feet.
What shape should a character's collision box be?
A capsule or a rectangle. Capsules slide off corners and slopes more smoothly, while rectangles are simple and predictable on tile grids. Avoid polygon or pixel-precise masks for moving characters.
Should the hitbox change with each animation frame?
The body collider should not; keep one box per movement state and swap boxes for states like crouching. Attack hitboxes are different and should appear only on the frames where the attack is active.
How do I size hitboxes in a top-down game?
Make the body collider cover only the footprint at the character's feet, roughly the bottom 20 to 30 percent of the sprite. That lets characters walk close to and behind objects. Use a separate, taller hurtbox for damage.