William Edward Burghardt Du Bois was born on February 23, 1868, in
Great Barrington, Massachusetts, to Alfred and Mary Silvina (née Burghardt) Du Bois.
 Mary Silvina Burghardt's family was part of the very small
free black population of Great Barrington and had long owned land in the state. She was descended from
 William Du Bois's maternal great-great-grandfather was Tom Burghardt, a
slave (born in
West Africa around 1730) who was held by the Dutch colonist Conraed Burghardt. Tom briefly served in the
Continental Army during the
American Revolutionary War, which may have been how he gained his freedom during the 18th century.
 His son Jack Burghardt was the father of Othello Burghardt, who was the father of Mary Silvina Burghardt.
William Du Bois claimed
Elizabeth Freeman as his relative and wrote that she married Jack Burghardt.
 But Freeman was 20 years older than Burghardt, and no record of such a marriage has been found. It may have been Freeman's daughter, Betsy Humphrey, who married Burghardt after her first husband, Jonah Humphrey, left the area "around 1811", and after Burghardt's first wife died (c. 1810). If so, Freeman would have been William Du Bois's step-great-great-grandmother. Anecdotal evidence supports Humphrey's marrying Burghardt; a close relationship of some form is likely.
William Du Bois's paternal great-grandfather was James Du Bois of
Poughkeepsie, New York, an ethnic
Huguenot origin who fathered several children with slave women.
 One of James'
mixed-race sons was Alexander, who was born on
Long Cay in
the Bahamas in 1803; in 1810 he immigrated to the United States with his father.
 He traveled and worked in
Haiti, where he fathered a son, Alfred, with a mistress. Alexander returned to Connecticut, leaving Alfred in Haiti with his mother.
Sometime before 1860, Alfred Du Bois emigrated to the United States, settling in Massachusetts. He married Mary Silvina Burghardt on February 5, 1867, in
 Alfred left Mary in 1870, two years after their son William was born.
 Mary Burghardt Du Bois moved with her son back to her parents' house in Great Barrington until he was five. She worked to support her family (receiving some assistance from her brother and neighbors), until she suffered a
stroke in the early 1880s. She died in 1885.
Great Barrington had a majority
European American community, who treated Du Bois generally well. He attended the local integrated public school and played with white schoolmates. As an adult, he wrote about racism which he felt as a fatherless child and the experience of being a minority in the town. But teachers recognized his ability and encouraged his intellectual pursuits, and his rewarding experience with academic studies led him to believe that he could use his knowledge to empower African Americans.
 Du Bois graduated from the town's
Searles High School. When Du Bois decided to attend college, the congregation of his childhood church, the
First Congregational Church of Great Barrington, raised the money for his tuition.
The title page of Du Bois's Harvard dissertation, Suppression of the African Slave Trade in the United States of America: 1638–1871
Relying on money donated by neighbors, Du Bois attended
Fisk University, a
historically black college in
Nashville, Tennessee, from 1885 to 1888.
 His travel to and residency in the South was Du Bois's first experience with Southern racism, which at the time encompassed
Jim Crow laws, bigotry, suppression of black voting, and
lynchings; the lattermost reached a peak in the next decade.
 After receiving a
bachelor's degree from Fisk, he attended
Harvard College (which did not accept course credits from Fisk) from 1888 to 1890, where he was strongly influenced by his professor
William James, prominent in American philosophy.
 Du Bois paid his way through three years at Harvard with money from summer jobs, an inheritance, scholarships, and loans from friends. In 1890, Harvard awarded Du Bois his second bachelor's degree,
cum laude, in history.
 In 1891, Du Bois received a scholarship to attend the sociology graduate school at Harvard.
In 1892, Du Bois received a fellowship from the
John F. Slater Fund for the Education of Freedmen to attend the
University of Berlin for graduate work.
 While a student in
Berlin, he traveled extensively throughout Europe. He came of age intellectually in the German capital, while studying with some of that nation's most prominent
social scientists, including
Gustav von Schmoller,
Adolph Wagner, and
Heinrich von Treitschke.
 After returning from Europe, Du Bois completed his graduate studies; in 1895 he was the first African American to earn a
Ph.D. from Harvard University.
Wilberforce and Philadelphia
"Between me and the other world there is ever an unasked question: ... How does it feel to be a problem? ... One ever feels his two-ness,–an American, a Negro; two souls, two thoughts, two unreconciled strivings; two warring ideals in one dark body, whose dogged strength alone keeps it from being torn asunder ... He would not Africanize America, for America has too much to teach the world and Africa. He would not bleach his Negro soul in a flood of white Americanism, for he knows that Negro blood has a message for the world. He simply wishes to make it possible for a man to be both a Negro and an American, without being cursed and spit upon by his fellows, without having the doors of Opportunity closed roughly in his face."
—Du Bois, "Strivings of the Negro People", 1897
In the summer of 1894, Du Bois received several job offers, including one from the prestigious
Tuskegee Institute; he accepted a teaching job at
Wilberforce University in Ohio.
 At Wilberforce, Du Bois was strongly influenced by
Alexander Crummell, who believed that ideas and morals are necessary tools to effect social change.
 While at Wilberforce, Du Bois married Nina Gomer, one of his students, on May 12, 1896.
After two years at Wilberforce, Du Bois accepted a one-year research job from the
University of Pennsylvania as an "assistant in sociology" in the summer of 1896.
 He performed sociological field research in Philadelphia's African-American neighborhoods, which formed the foundation for his landmark study,
The Philadelphia Negro, published in 1899 while he was teaching at
Atlanta University. It was the first case study of a black community in the United States.
 By the 1890s, Philadelphia's black neighborhoods had a negative reputation in terms of crime, poverty, and mortality. Du Bois's book undermined the stereotypes with experimental evidence, and shaped his approach to segregation and its negative impact on black lives and reputations. The results led Du Bois to realize that racial integration was the key to democratic equality in American cities.
While taking part in the
American Negro Academy (ANA) in 1897, Du Bois presented a paper in which he rejected
Frederick Douglass's plea for black Americans to integrate into white society. He wrote: "we are Negroes, members of a vast historic race that from the very dawn of creation has slept, but half awakening in the dark forests of its African fatherland".
 In the August 1897 issue of
The Atlantic Monthly, Du Bois published "Strivings of the Negro People", his first work aimed at the general public, in which he enlarged upon his thesis that African Americans should embrace their African heritage while contributing to American society.