Evolutionary theory predicts that in the absence of outcrossing opportunities, simultaneously hermaphroditic organisms should eventually switch to self-fertilization as a form of reproductive assurance. Here, we report the existence of facultative self-fertilization in the free-living flatworm Macrostomum hystrix, a species in which outcrossing occurs via hypodermic insemination of sperm into the parenchyma of the mating partner. First, we show that isolated individuals significantly delay the onset of reproduction compared with individuals with outcrossing opportunities ('delayed selfing') as predicted by theory. Second, consistent with the idea of M. hystrix being a preferential outcrosser under natural conditions, we report likely costs of selfing manifested via reduced hatchling production and offspring survival. Third, we demonstrate that selfing propensity has a genetic basis in this species, with a heritability estimated at 0.43 ± 0.11. Variation in selfing propensity could arise due to differing costs of inbreeding among families; despite marked inter-family variation in apparent costs of inbreeding, we found no evidence for such a link. Alternatively, selfing propensity might differ across families because of heritable variation in reproductive traits that determine the likelihood of selfing. We speculate that adaptations to hypodermic insemination under outcrossing, most notably a highly modified copulatory stylet (male copulatory organ) and reduced sperm complexity, could also facilitate facultative selfing in this species.