Musk was born on June 28, 1971, in Pretoria, Transvaal, South Africa, the son of Maye Musk (née Haldeman), a model and dietitian from Regina, Saskatchewan, Canada, and Errol Musk, a South African electromechanical engineer, pilot, and sailor. He has a younger brother, Kimbal (born 1972), and a younger sister, Tosca (born 1974). His maternal grandfather, Dr. Joshua Haldeman, was an American-born Canadian. His paternal grandmother was British, and he also has Pennsylvania Dutch ancestry. After his parents divorced in 1980, Musk lived mostly with his father in the suburbs of Pretoria, which Musk chose two years after his parents split up, but now Musk says it was a mistake. As an adult, Musk has severed relations with his father, whom he has referred to as "a terrible human being". He has a half-sister and a half-brother.
During his childhood, Musk was an avid reader. At the age of 10, he developed an interest in computing with the Commodore VIC-20. He taught himself computer programming at the age of 10, and by the age of 12 sold the code of a BASIC-based video game he created called Blastar, to a magazine called PC and Office Technology, for approximately $500. A web version of the game is available online.
His childhood reading included Isaac Asimov's Foundation series, from which he drew the lesson that "you should try to take the set of actions that are likely to prolong civilization, minimize the probability of a dark age and reduce the length of a dark age if there is one."
Musk was severely bullied throughout his childhood and was once hospitalized when a group of boys threw him down a flight of stairs and then smashed his head into the pavement until he lost consciousness. He later revealed that he had to get a nose job, to repair the damage.
Musk attended Waterkloof House Preparatory School and Bryanston High School before graduating from Pretoria Boys High School. Although Musk's father insisted that Elon go to college in Pretoria, Musk became determined to move to the United States. As he states, "I remember thinking and seeing that America is where great things are possible, more than any other country in the world." Knowing it would be easy to get to the United States from Canada, he moved to Canada against his father's wishes in June 1989, just before his 18th birthday, after obtaining a Canadian passport through his Canadian-born mother.