Delete Entities in Area (c)
factorio — Console Commands
Removes all entities (buildings, trees, rocks) within a specified rectangular area. Useful for clearing space or debugging map issues.
Syntax
/c local surface=game.player.surface; local area={{X1,Y1},{X2,Y2}}; for _, entity in pairs(surface.find_entities(area)) do entity.destroy() end
Example
/c local surface=game.player.surface; local area={{-50,-50},{50,50}}; for _, entity in pairs(surface.find_entities(area)) do entity.destroy() end
💡 Notes
Coordinates are tile positions relative to the map origin. This destroys all entity types, including chests and belts, but not tiles or resources.
🎯 Tips & Tricks
Filter by type
Modify the loop to check entity.type, e.g., if entity.type=='tree' then entity.destroy() end, to only remove trees.
Use with god mode
Combine with god mode to fly over the area and visually confirm the coordinates before deleting.
🔧 Troubleshooting
Nothing deleted
Check your coordinates; ensure X1<X2 and Y1<Y2, and that the area is within the generated map.
Accidentally deleted base
Always save before running; there is no built-in undo for entity destruction.
⚠️ Common Mistakes
- Using wrong coordinate order
- Deleting entire base without backup
- Running on multiplayer without admin consent
👍 Pros
- Clears large areas quickly
- Removes unwanted structures
- Useful for map cleanup
- Precise area control
👎 Cons
- Destroys player-built items too
- No undo without save
- Can lag with many entities