Animals that move through complex habitats must frequently contend with obstacles in their path. Humans and other highly cognitive vertebrates avoid collisions by perceiving the relationship between the layout of their surroundings and the properties of their own body profile and action capacity. It is unknown whether insects, which have much smaller brains, possess such abilities. We used bumblebees, which vary widely in body size and regularly forage in dense vegetation, to investigate whether flying insects consider their own size when interacting with their surroundings. Bumblebees trained to fly in a tunnel were sporadically presented with an obstructing wall containing a gap that varied in width. Bees successfully flew through narrow gaps, even those that were much smaller than their wingspans, by first performing lateral scanning (side-to-side flights) to visually assess the aperture. Bees then reoriented their in-flight posture (i.e., yaw or heading angle) while passing through, minimizing their projected frontal width and mitigating collisions; in extreme cases, bees flew entirely sideways through the gap. Both the time that bees spent scanning during their approach and the extent to which they reoriented themselves to pass through the gap were determined not by the absolute size of the gap, but by the size of the gap relative to each bee's own wingspan. Our findings suggest that, similar to humans and other vertebrates, flying bumblebees perceive the affordance of their surroundings relative their body size and form to navigate safely through complex environments.