During pregnancy, mothers-to-be should adapt their diet to meet increases in nutrient requirements. Pregnant women appear to be keener to adopt healthier diets, but are not always successful. The objective of the present study was to determine whether a guided, stepwise and tailored dietary counselling programme, designed using an optimisation algorithm, could improve the nutrient adequacy of the diet of pregnant women, beyond generic guidelines. Pregnant women (n 80) who attended Notre-Dame-de-Bon-Secours Maternity Clinic were randomly allocated to the control or intervention arm. Dietary data were obtained twice from an online 3-d dietary record. The nutrient adequacy of the diet was calculated using the PANDiet score, a 100-point diet quality index adapted to the specific nutrient requirements for pregnancy. Women were supplied with generic dietary guidelines in a reference booklet. In the intervention arm, they also received nine sets of tailored dietary advice identified by an optimisation algorithm as best improving their PANDiet score. Pregnant women (n 78) completed the 12-week dietary follow-up. Initial PANDiet scores were similar in the control and intervention arms (60·4 (sd 7·3) v. 60·3 (sd 7·3), P = 0·92). The PANDiet score increased in the intervention arm (+3·6 (sd 9·3), P = 0·02) but not in the control arm (−0·3 (sd 7·3), P = 0·77), and these changes differed between arms (P = 0·04). In the intervention arm, there were improvements in the probabilities of adequacy for α-linolenic acid, thiamin, folate and cholesterol intakes (P < 0·05). Tailored dietary counselling using a computer-based algorithm is more effective than generic dietary counselling alone in improving the nutrient adequacy of the diet of French women in mid-pregnancy.