We have established a new simple behavioral paradigm in Drosophila melanogaster to determine how genes and the environment influence the behavior of flies within a social group. Specifically, we measure social space as the distance between two flies. The majority of Canton-s flies, regardless of their gender, are within two body lengths from each other. Their social experience affects this behavior, with social isolation reducing and mating enhancing social space respectively, in both males and females. Unlike several other social behaviors in the fly, including the formation of social groups themselves (a well-described behavior), social space does not require the perception of the previously identified aggregation pheromone cis-vaccenyl acetate. Conversely, performance of the assay in darkness or mutations in the eye pigmentation gene white increased social space. Our results establish a new assay for the genetic dissection of a fundamental mode of social interaction.