Female Drosophila choose their sites for oviposition with deliberation. Female flies employ sensitive chemosensory systems to evaluate chemical cues for egg-laying substrates, but how they determine the physical quality of an oviposition patch remains largely unexplored. Here we report that flies evaluate the stiffness of the substrate surface using sensory structures on their appendages. The TRPV family channel Nanchung is required for the detection of all stiffness ranges tested, whereas two other proteins, Inactive and DmPiezo, interact with Nanchung to sense certain spectral ranges of substrate stiffness differences. Furthermore, Tmc is critical for sensing subtle differences in substrate stiffness. The Tmc channel is expressed in distinct patterns on the labellum and legs and the mechanosensory inputs coordinate to direct the final decision making for egg laying. Our study thus reveals the machinery for deliberate egg-laying decision making in fruit flies to ensure optimal survival for their offspring.