John Stuart Mill was born at 13 Rodney Street in Pentonville, Middlesex, the eldest son of the Scottish philosopher, historian and economist James Mill, and Harriet Barrow. John Stuart was educated by his father, with the advice and assistance of Jeremy Bentham and Francis Place. He was given an extremely rigorous upbringing, and was deliberately shielded from association with children his own age other than his siblings. His father, a follower of Bentham and an adherent of associationism, had as his explicit aim to create a genius intellect that would carry on the cause of utilitarianism and its implementation after he and Bentham had died.
Mill was a notably precocious child. He describes his education in his autobiography. At the age of three he was taught Greek. By the age of eight, he had read Aesop's Fables, Xenophon's Anabasis, and the whole of Herodotus, and was acquainted with Lucian, Diogenes Laërtius, Isocrates and six dialogues of Plato. He had also read a great deal of history in English and had been taught arithmetic, physics and astronomy.
At the age of eight, Mill began studying Latin, the works of Euclid, and algebra, and was appointed schoolmaster to the younger children of the family. His main reading was still history, but he went through all the commonly taught Latin and Greek authors and by the age of ten could read Plato and Demosthenes with ease. His father also thought that it was important for Mill to study and compose poetry. One of Mill's earliest poetic compositions was a continuation of the Iliad. In his spare time he also enjoyed reading about natural sciences and popular novels, such as Don Quixote and Robinson Crusoe.
His father's work, The History of British India was published in 1818; immediately thereafter, at about the age of twelve, Mill began a thorough study of the scholastic logic, at the same time reading Aristotle's logical treatises in the original language. In the following year he was introduced to political economy and studied Adam Smith and David Ricardo with his father, ultimately completing their classical economic view of factors of production. Mill's comptes rendus of his daily economy lessons helped his father in writing Elements of Political Economy in 1821, a textbook to promote the ideas of Ricardian economics; however, the book lacked popular support. Ricardo, who was a close friend of his father, used to invite the young Mill to his house for a walk in order to talk about political economy.
At the age of fourteen, Mill stayed a year in France with the family of Sir Samuel Bentham, brother of Jeremy Bentham. The mountain scenery he saw led to a lifelong taste for mountain landscapes. The lively and friendly way of life of the French also left a deep impression on him. In Montpellier, he attended the winter courses on chemistry, zoology, logic of the Faculté des Sciences, as well as taking a course in higher mathematics. While coming and going from France, he stayed in Paris for a few days in the house of the renowned economist Jean-Baptiste Say, a friend of Mill's father. There he met many leaders of the Liberal party, as well as other notable Parisians, including Henri Saint-Simon.
Mill went through months of sadness and pondered suicide at twenty years of age. According to the opening paragraphs of Chapter V of his autobiography, he had asked himself whether the creation of a just society, his life's objective, would actually make him happy. His heart answered "no", and unsurprisingly he lost the happiness of striving towards this objective. Eventually, the poetry of  With renewed joy he continued to work towards a just society, but with more relish for the journey. He considered this one of the most pivotal shifts in his thinking. In fact, many of the differences between him and his father stemmed from this expanded source of joy.
Mill had been engaged in a pen-friendship with Auguste Comte, the founder of positivism and sociology, since Mill first contacted Comte in November 1841. Comte's sociologie was more an early philosophy of science than we perhaps know it today, and the positive philosophy aided in Mill's broad rejection of Benthamism.
As a nonconformist who refused to subscribe to the Thirty-Nine Articles of the Church of England, Mill was not eligible to study at the University of Oxford or the University of Cambridge. Instead he followed his father to work for the East India Company, and attended University College, London, to hear the lectures of John Austin, the first Professor of Jurisprudence. He was elected a Foreign Honorary Member of the American Academy of Arts and Sciences in 1856.
Mill's career as a colonial administrator at the British East India Company spanned from when he was 17 years old in 1823 until 1858, when the Company was abolished in favor of direct rule by the British crown over India. In 1836, he was promoted to the Company's Political Department, where he was responsible for correspondence pertaining to the Company's relations with the princely states, and in 1856, was finally promoted to the position of Examiner of Indian Correspondence. In On Liberty, A Few Words on Non-Intervention, and other works, Mill defended British imperialism by arguing that a fundamental distinction existed between civilized and barbarous peoples. Mill viewed countries such as India and China as having once been progressive, but that were now stagnant and barbarous, thus legitimizing British rule as benevolent despotism, "provided the end is [the barbarians'] improvement." When the crown proposed to take direct control over the colonies in India, he was tasked with defending Company rule, penning Memorandum on the Improvements in the Administration of India during the Last Thirty Years among other petitions. He was offered a seat on the Council of India, the body created to advise the new Secretary of State for India, but declined, citing his disapproval of the new system of rule.
In 1851, Mill married Harriet Taylor after 21 years of intimate friendship. Taylor was married when they met, and their relationship was close but generally believed to be chaste during the years before her first husband died. Brilliant in her own right, Taylor was a significant influence on Mill's work and ideas during both friendship and marriage. His relationship with Harriet Taylor reinforced Mill's advocacy of women's rights. He cites her influence in his final revision of On Liberty, which was published shortly after her death. Taylor died in 1858 after developing severe lung congestion, after only seven years of marriage to Mill.
Between the years 1865 and 1868 Mill served as Lord Rector of the University of St. Andrews. During the same period, 1865–68, he was a Member of Parliament for City and Westminster. He was sitting for the Liberal Party. During his time as an MP, Mill advocated easing the burdens on Ireland. In 1866, Mill became the first person in the history of Parliament to call for women to be given the right to vote, vigorously defending this position in subsequent debate. Mill became a strong advocate of such social reforms as labour unions and farm cooperatives. In Considerations on Representative Government, Mill called for various reforms of Parliament and voting, especially proportional representation, the single transferable vote, and the extension of suffrage. In April 1868, Mill favoured in a Commons debate the retention of capital punishment for such crimes as aggravated murder; he termed its abolition "an effeminacy in the general mind of the country."
He was godfather to the philosopher Bertrand Russell.
In his views on religion, Mill was an agnostic.
Mill died in 1873 of erysipelas in Avignon, France, where his body was buried alongside his wife's.