Since his father, an Englishman who had settled in Ireland, died before his birth and his mother deserted him for some time, Swift was dependent upon an uncle for his education. He was sent first to Kilkenny School and then to Trinity College, Dublin, where he managed, in spite of his rebellious behavior, to obtain a degree. In 1689 he became secretary to Sir William Temple at Moor Park, Surrey, where he formed his lifelong attachment to Esther Johnson, the "Stella" of his famous journal. Disappointed of church preferment in England, Swift returned to Ireland, where he was ordained an Anglican priest and in 1695 was given the small prebend of Kilroot.
Unable to make a success in Ireland, Swift returned to Moor Park the following year, remaining until Temple's death in 1699. During this period he wrote The Battle of the Books, in which he defended Temple's contention that the ancients were superior to the moderns in literature and learning, and A Tale of a Tub, a satire on religious excesses. These works were not published, however, until 1704. Again disappointment with his advancement sent him back to Ireland, where he was given the living of Laracor.
In the course of numerous visits to London he became friendly with Addison and Steele and active in Whig politics. His Whig sympathies were severed, however, when that party demonstrated its unfriendliness to the Anglican Church. In 1708 he began a series of pamphlets on ecclesiastical issues with his ironic Argument against Abolishing Christianity. He joined the Tories in 1710, edited the Tory Examiner for a year, and wrote various political pamphlets, notably The Conduct of the Allies (1711), Remarks on the Barrier Treaty (1712), and The Public Spirit of the Whigs (1714), in reply to Steele's Crisis.