Animal response to changes in environmental cues is a complex dynamical process that occurs at diverse molecular and cellular levels. To gain a quantitative understanding of such processes, it is desirable to observe many individuals, subjected to repeatable and well defined environmental cues over long time periods. Here we present WormSpa, a microfluidic system where worms are individually confined in optimized chambers. We show that worms in WormSpa are neither stressed nor starved, and in particular exhibit pumping and egg-laying behaviors equivalent to those of freely behaving worms. We demonstrate the applicability of WormSpa for studying stress response and physiological processes. WormSpa is simple to make and easy to operate, and its design is modular, making it straightforward to incorporate available microfluidic technologies. We expect that WormSpa would open novel avenues of research, hitherto impossible or impractical.