The ketogenic diet (KD) is a high fat and low carbohydrate and protein diet. It is used in the clinical treatment of epilepsy, in order to decrease cerebral excitability. KD is usually composed by long-chain triglycerides (LCT) while medium-chain triglycerides (MCT) diet is beginning to be used in some clinical treatment of disorders of pyruvate carboxylase enzyme and long-chain fatty acid oxidation. Our study aimed to analyze the effects of medium- and long-chain KD on cerebral electrical activity, analyzing the propagation of the phenomenon of cortical spreading depression (CSD). Three groups of weaned rats (21 days old) received, for 7 weeks, either a control (AIN-93G diet), or a MCT-KD (rich in triheptanoin oil), or a LCT-KD (rich in soybean oil). They were compared to another three groups (21 days old) receiving the same diets for just 10 days. CSD propagation was evaluated just after ending the dietary treatments. Results showed that short-term KD treatment resulted in a significant reduction of the CSD velocity of propagation (control group: 4.02+/-1.04mm/min; MCT-KD: 0.81+/-1.46mm/min and LCT-KD: 2.26+/-0.41mm/min) compared to the control group. However, long-term treatment with both KDs had no effect on the CSD velocity (control group: 3.10+/-0.41mm/min, MCT-KD: 2.91+/-1.62mm/min, LCT-KD: 3.02+/-2.26mm/min) suggesting that both short-term KDs have a positive effect in decreasing brain cerebral excitability in young animals. These data show for the first time that triheptanoin has an effect on central nervous system.