Developmental plasticity is the ability of a genotype to express multiple phenotypes under different environmental conditions and has been shown to facilitate the evolution of novel traits. However, while the associated cost of plasticity, i.e., the loss in fitness due to the plastic response to environment, and the cost of phenotype, i.e., the loss of fitness due to expressing a fixed phenotype across environments, have been theoretically predicted, empirically such costs remain poorly documented and little understood. Here, we use a plasticity model system, hermaphroditic nematode Pristionchus pacificus, to experimentally measure these costs in wild isolates under controlled laboratory conditions. P. pacificus can develop either a bacterial feeding or predatory mouth morph in response to different external stimuli, with natural variation of mouth-morph ratios between strains. We first demonstrated the cost of phenotype by analyzing fecundity and developmental speed in relation to mouth morphs across the P. pacificus phylogenetic tree. Then, we exposed P. pacificus strains to two distinct microbial diets that induce strain-specific mouth-form ratios. Our results indicate that the plastic strain does shoulder a cost of plasticity, i.e., the diet-induced predatory mouth morph is associated with reduced fecundity and slower developmental speed. In contrast, the non-plastic strain suffers from the cost of phenotype since its phenotype does not change to match the unfavorable bacterial diet, but shows increased fitness and higher developmental speed on the favorable diet. Furthermore, using a stage-structured population model based on empirically-derived life history parameters, we show how population structure can alleviate the cost of plasticity in P. pacificus. The results of the model illustrate the extent to which the costs associated with plasticity and its effect of competition depend on ecological factors. This study provides comprehensive support for the costs of plasticity and phenotype based on empirical and modeling approaches.Impact SummaryA genotype able to express a range of phenotypes in response to environmental conditions, that is to demonstrate developmental plasticity, would be a Darwinian demon, able to infinitely adapt and outcompete those genotypes that require genetic change to express a phenotype fit to an environment. It has been suggested that the absence of such demons in nature is due to the cost of plasticity, i.e., developmental plasticity results in a reduction of biological fitness compared to a genotype that facultatively expresses a phenotype matching the environment. While conceptually simple, measuring the cost of plasticity in nature has proven a major challenge. We use the nematode P. pacificus to measure the cost of plasticity. During its development, P. pacificus can assume one of two possible mouth forms: predatory or non-predatory. The likelihood developing any of these two mouth forms is determined by a gene regulatory network, which itself is affected by a wide range on environmental conditions, including diet. We used two strains of P. pacificus and grew them on two different bacterial diets. The plastic strain was capable of switching from non-predatory to predatory mouth form depending on the diet, while the non-plastic strain could only express the predatory mouth form on either of the diets. By measuring the number eggs laid in both strain on each diet, we show that the plastic response is associated with a reduction in fecundity, thus providing a clear example of the cost of plasticity. We then use a stage-structured model to simulate the population dynamics of the plastic and the non-plastic strains. Our simulation show that the cost of plasticity is highly context dependent and its ecological ramifications can be greatly influenced by biotic and abiotic factors.