Obesity is a major health issue. Obesity started from teenagers has become a major health concern in recent years. Intermittent fasting increases the life span. However, it is not known whether obesity and intermittent fasting affect brain functions and structures before brain aging. Here, we subjected 7-week old CD-1 wild type male mice to intermittent (alternate-day) fasting or high fat diet (45% caloric supplied by fat) for 11 months. Mice on intermittent fasting had better learning and memory assessed by the Barnes maze and fear conditioning, thicker CA1 pyramidal cell layer, higher expression of drebrin, a dendritic protein, and lower oxidative stress than mice that had free access to regular diet (control mice). Mice fed with high fat diet was obese and with hyperlipidemia. They also had poorer exercise tolerance. However, these obese mice did not present significant learning and memory impairment or changes in brain structures or oxidative stress compared with control mice. These results suggest that intermittent fasting improves brain functions and structures and that high fat diet feeding started early in life does not cause significant changes in brain functions and structures in obese middle-aged animals.