Heinrich Luitpold Himmler was born in Munich on 7 October 1900 into a conservative middle-class Roman Catholic family. His father was Joseph Gebhard Himmler (17 May 1865 – 29 October 1936), a teacher, and his mother was Anna Maria Himmler (née Heyder; 16 January 1866 – 10 September 1941), a devout Roman Catholic. Heinrich had two brothers, Gebhard Ludwig (29 July 1898 – 1982) and Ernst Hermann (23 December 1905 – 2 May 1945).
Himmler's first name, Heinrich, was that of his godfather, Prince Heinrich of Bavaria, a member of the royal family of Bavaria, who had been tutored by Gebhard Himmler. He attended a grammar school in Landshut, where his father was deputy principal. While he did well in his schoolwork, he struggled in athletics. He had poor health, suffering from lifelong stomach complaints and other ailments. In his youth he trained daily with weights and exercised to become stronger. Other boys at the school later remembered him as studious and awkward in social situations.
Himmler's diary, which he kept intermittently from the age of 10, shows that he took a keen interest in current events, dueling, and "the serious discussion of religion and sex". In 1915, he began training with the Landshut Cadet Corps. His father used his connections with the royal family to get Himmler accepted as an officer candidate, and he enlisted with the reserve battalion of the 11th Bavarian Regiment in December 1917. His brother, Gebhard, served on the western front and saw combat, receiving the Iron Cross and eventually being promoted to lieutenant. In November 1918, while Himmler was still in training, the war ended with Germany's defeat, denying him the opportunity to become an officer or see combat. After his discharge on 18 December, he returned to Landshut. After the war, Himmler completed his grammar-school education. From 1919–22, he studied agronomy at the Munich Technische Hochschule (now Technical University Munich) following a brief apprenticeship on a farm and a subsequent illness.
Although many regulations that discriminated against non-Christians—including Jews and other minority groups—had been eliminated during the unification of Germany in 1871, antisemitism continued to exist and thrive in Germany and other parts of Europe. Himmler was antisemitic by the time he went to university, but not exceptionally so; students at his school would avoid their Jewish classmates. He remained a devoted Catholic while a student, and spent most of his leisure time with members of his fencing fraternity, the "League of Apollo", the president of which was Jewish. Himmler maintained a polite demeanor with him and with other Jewish members of the fraternity, in spite of his growing antisemitism. During his second year at university, Himmler redoubled his attempts to pursue a military career. Although he was not successful, he was able to extend his involvement in the paramilitary scene in Munich. It was at this time that he first met Ernst Röhm, an early member of the Nazi Party and co-founder of the Sturmabteilung ("Storm Battalion"; SA). Himmler admired Röhm because he was a decorated combat soldier, and at his suggestion Himmler joined his antisemitic nationalist group, the Bund Reichskriegsflagge (Imperial War Flag Society).
In 1922, Himmler became more interested in the "Jewish question", with his diary entries containing an increasing number of antisemitic remarks and recording a number of discussions about Jews with his classmates. His reading lists, as recorded in his diary, were dominated by antisemitic pamphlets, German myths, and occult tracts. After the murder of Foreign Minister Walther Rathenau on 24 June, Himmler's political views veered towards the radical right, and he took part in demonstrations against the Treaty of Versailles. Hyperinflation was raging, and his parents could no longer afford to educate all three sons. Disappointed by his failure to make a career in the military and his parents' inability to finance his doctoral studies, he was forced to take a low-paying office job after obtaining his agricultural diploma. He remained in this position until September 1923.
Himmler joined the Nazi Party (NSDAP) in August 1923, receiving Party number 14,303. As a member of Röhm's paramilitary unit, Himmler was involved in the Beer Hall Putsch—an unsuccessful attempt by Hitler and the NSDAP to seize power in Munich. This event would set Himmler on a life of politics. He was questioned by the police about his role in the putsch, but was not charged because of insufficient evidence. However, he lost his job, was unable to find employment as an agronomist, and had to move in with his parents in Munich. Frustrated by these failures, he became ever more irritable, aggressive, and opinionated, alienating both friends and family members.
In 1923–24, Himmler, while searching for a world view, came to abandon Catholicism and focused on the occult and in antisemitism. Germanic mythology, reinforced by occult ideas, became a religion for him. Himmler found the NSDAP appealing because its political positions agreed with his own views. Initially, he was not swept up by Hitler's charisma or the cult of Führer worship. However, as he learned more about Hitler through his reading, he began to regard him as a useful face of the party, and he later admired and even worshipped him. To consolidate and advance his own position in the NSDAP, Himmler took advantage of the disarray in the party following Hitler's arrest in the wake of the Beer Hall Putsch. From mid-1924 he worked under Gregor Strasser as a party secretary and propaganda assistant. Travelling all over Bavaria agitating for the party, he gave speeches and distributed literature. Placed in charge of the party office in Lower Bavaria by Strasser from late 1924, he was responsible for integrating the area's membership with the NSDAP under Hitler when the party was re-founded in February 1925.
That same year, he joined the Schutzstaffel (SS) as an SS-Führer (SS-Leader); his SS number was 168. The SS, initially part of the much larger SA, was formed in 1923 for Hitler's personal protection, and was re-formed in 1925 as an elite unit of the SA. Himmler's first leadership position in the SS was that of SS-Gauführer (district leader) in Lower Bavaria from 1926. Strasser appointed Himmler deputy propaganda chief in January 1927. As was typical in the NSDAP, he had considerable freedom of action in his post, which increased over time. He began to collect statistics on the number of Jews, Freemasons, and enemies of the party, and following his strong need for control, he developed an elaborate bureaucracy. In September 1927, Himmler told Hitler of his vision to transform the SS into a loyal, powerful, racially pure elite unit. Convinced that Himmler was the man for the job, Hitler appointed him Deputy Reichsführer-SS, with the rank of SS-Oberführer.
Around this time, Himmler joined the Artaman League, a Völkisch youth group. There he met Rudolf Höss, who was later commandant of Auschwitz concentration camp, and Walther Darré, whose book, The Peasantry as the Life Source of the Nordic Race, caught Hitler's attention, leading to his later appointment as Reich Minister of Food and Agriculture. Darré was a firm believer in the superiority of the Nordic race, and his philosophy was a major influence on Himmler.