Palme was born into an upper class, conservative Lutheran family in the Östermalm district of Stockholm, Sweden. The Palme family is of Dutch ancestry and is related to several other prominent Swedish families such as the von Sydows and the Wallenbergs. His father Gunnar Palme was a businessman, son of Sven Theodore Palme and Baroness Hanna Maria von Born-Sarvilahti. Through her, Olof Palme claimed ancestry from King Frederik I of Denmark. His mother, Elisabeth von Knieriem, was descended from Baltic German tradesmen; she had arrived in Sweden from Russia as a refugee in 1915. Elisabeth's great-great-great grandfather Johann Melchior von Knieriem (1758–1817) had been ennobled by the Emperor Alexander I of Russia in 1814. Her great-grandfather Alexander von Knieriem (1837–1904) was an attorney general of the Senate of Russian Empire, senator and member of the State Council of Imperial Russia. The von Knieriem do not count as members of the Baltische Ridderschaft. Palme's father died when he was six years old. Despite his background, his political orientation came to be influenced by Social Democratic attitudes. His travels in the Third World, as well as the United States, where he saw deep economic inequality and racial segregation, helped to develop these views.
A sickly child, Olof Palme received his education from private tutors. Even as a child he gained knowledge of two foreign languages – German and English. He studied at the Sigtuna School of Liberal Arts, one of Sweden's few residential high schools, and passed the university entrance examination with high marks at the age of 17. He was called up into the Army in January 1945 and did his compulsory military service at A 1 between 1945 and 1947, became in 1956 a reserve officer with the rank of Captain in the Artillery. After he was discharged from military service in March 1947, he enrolled at the University of Stockholm.
On a scholarship, he studied at Kenyon College, a small liberal arts school in central Ohio from 1947 to 1948, graduating with a BA Inspired by radical debate in the student community, he wrote a critical essay on Friedrich Hayek's The Road to Serfdom. Palme wrote his senior honour thesis on the United Auto Workers union, led at the time by Walter Reuther. After graduation he traveled throughout the country and eventually ended up in Detroit, where his hero Reuther agreed to an interview which lasted several hours. In later years, Palme regularly remarked during his many subsequent American visits, that the United States had made him a socialist, a remark that often has caused confusion. Within the context of his American experience, it was not that Palme was repelled by what he found in America, but rather that he was inspired by it.
After hitchhiking through the USA and Mexico, he returned to Sweden to study law at Stockholm University. In 1949 he became a member of the Swedish Social Democratic Party. During his time at university, Palme became involved in student politics, working with the Swedish National Union of Students. In 1951, he became a member of the social democratic student association in Stockholm, although it is asserted he did not attend their political meetings at the time. The following year he was elected President of the Swedish National Union of Students. As a student politician he concentrated on international affairs and travelled across Europe.
Palme attributed his becoming a socialist to three major influences:
- In 1947, he attended a debate on taxes between the Social Democrat , the conservative Jarl Hjalmarson and the liberal
- The time he spent in the United States in the 1940s made him realise how wide the class divide was in America, and the extent of racism against black people; and,
- A trip to Asia, specifically India, Ceylon (now Sri Lanka), Burma, Thailand, Singapore, Indonesia, and Japan in 1953 had opened his eyes to the consequences of colonialism and imperialism.
Palme was an atheist.