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 paternal grandmother was British, and he also has Pennsylvania Dutch ancestry. His maternal grandfather Joshua Haldeman was American, from Minnesota. 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 says was "not a good idea". As an adult, Musk has severed relations with his father. He has a half-sister, and half-brother.
During his childhood, Musk was an avid reader. At age 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 beat him until he lost consciousness.
Musk attended Waterkloof House Preparatory School, and Bryanston High School before graduating from Pretoria Boys High School. Though 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.
At age 17, in 1989, Elon Musk moved to Canada to attend Queen's University and avoid mandatory service in the South African military. He left in 1992 to study business and physics at the University of Pennsylvania. He graduated with an undergraduate degree in economics and stayed for a second bachelor's degree in physics.
After leaving Penn, Elon Musk headed to Stanford University in California to pursue a PhD in energy physics. However, his move was timed perfectly with the Internet boom, and he dropped out of Stanford after just two days to become a part of it, launching his first company, Zip2 Corporation.