Many opisthobranch gastropods embed their embryos in gelatinous egg masses; however, the functions of gel are not well known. We analyze the hypothesis that egg-mass gel protects embryos from salinity change. Using egg masses of Melanochlamys diomedea, we found that experimental removal of gel decreased the ability of embryos to survive osmotic stress. We evaluate several possible protective mechanisms by estimating osmotic influx of water into egg masses and by modeling salt efflux from an egg mass. On immersion in low-salinity water, egg masses lost roughly 23% of their mass, indicating that osmotic influx of water did not occur. Therefore, the principal route of salinity change within the egg mass is probably salt efflux. The model suggests that this efflux occurs quite slowly even when ambient salinity changes rapidly. Slow salinity change may be less stressful for embryos because the mechanisms that regulate cellular volume have more time to adjust. We show experimentally that slow salinity changes are less harmful to veligers than rapid ones by isolating capsules from egg-mass gel and exposing them to gradual or abrupt salinity change. The results support the hypothesis that rate of change of salinity is an important determinant of embryo survival and that egg-mass gel retards the rate of salinity change.