Sodium butyrate (SB) provided orally favours body growth and maturation of the gastrointestinal tract (GIT) in milk-fed pigs. In weaned pigs, conflicting results have been obtained. Therefore, we hypothesised that the effects of SB (3 g/kg DM intake) depend on the period (before v. after weaning) of its oral administration. From the age of 5 d, thirty-two pigs, blocked in quadruplicates within litters, were assigned to one of four treatments: no SB (control), SB before (for 24 d), or after (for 11–12 d) weaning and SB before and after weaning (for 35–36 d). Growth performance, feed intake and various end-point indices of GIT anatomy and physiology were investigated at slaughter. The pigs supplemented with SB before weaning grew faster after weaning than the controls (P < 0·05). The feed intake was higher in pigs supplemented with SB before or after weaning (P < 0·05). SB provided before weaning improved post-weaning faecal digestibility (P < 0·05) while SB after weaning decreased ileal and faecal digestibilities (P < 0·05). Gastric digesta retention was higher when SB was provided before weaning (P < 0·05). Post-weaning administration of SB decreased the activity of three pancreatic enzymes and five intestinal enzymes (P < 0·05). IL-18 gene expression tended to be lower in the mid-jejunum in SB-supplemented pigs. The small-intestinal mucosa was thinner and jejunal villous height lower in all SB groups (P < 0·05). In conclusion, the pre-weaning SB supplementation was the most efficient to stimulate body growth and feed intake after weaning, by reducing gastric emptying and intestinal mucosa weight and by increasing feed digestibility.