Housman was born in Fockbury, Worcestershire, the eldest of seven children of a country solicitor. His brother Laurence Housman and sister Clemence Housman also became writers.
Housman was educated first at King Edward's School, then Bromsgrove School, where he acquired a strong academic grounding and won prizes for his poetry. In 1877 he won an open scholarship to St John's College, Oxford, where he studied classics. He was a brilliant student, gaining first class honours in classical moderations, but a withdrawn person whose only friends were his roommates Moses Jackson and A. W. Pollard. Housman fell in love with the handsome, athletic Jackson who, being heterosexual, rejected him, though the two remained friends. This experience, reflected in some of his poems, may be an explanation of Housman's unexpected failure in his final exams (the "Greats") in 1881. Housman took this failure very seriously but managed to take a pass degree the next year, after a brief period of teaching in Bromsgrove School.
After graduating, Jackson got a job as a clerk in the Patent Office in London and arranged a job there for Housman as well. They shared an apartment with Jackson's brother Adalbert until 1885 when Housman moved in to lodgings of his own. Moses Jackson married and moved to Ceylon in 1887 and Adalbert Jackson died in 1892. Housman continued pursuing classical studies independently and published scholarly articles on such authors as Horace, Propertius, Ovid, Aeschylus, Euripides and Sophocles. He gradually acquired such a high reputation that in 1892 he was offered the professorship of Latin at University College London, which he accepted.
Although Housman's sphere of responsibilities as professor included both Latin and Greek, he put most of his energy in the study of Latin classics. His reputation in this field grew steadily, and in 1911 he took the Kennedy Professorship of Latin at Trinity College, Cambridge, where he remained for the rest of his life. It was unusual at the time for an Oxford man such as Housman to be hired at Cambridge. During 1903–1930, he published his critical edition of Manilius's Astronomicon in five volumes. He also edited works of Juvenal (1905) and Lucan (1926). Many colleagues were afraid of his scathing critical attacks on those whom he found guilty of unscholarly sloppiness. To his students he appeared as a severe, reticent, remote authority. The only pleasures he allowed himself in his spare time were those of gastronomy which he also practised on frequent visits to France and Italy.
Housman always found his true vocation in classical studies and treated poetry as a secondary activity. He never spoke about his poetry in public until 1933 when he gave a lecture, "The Name and Nature of Poetry", in which he argued that poetry should appeal to emotions rather than intellect. He died two years later in Cambridge. His ashes are buried near St Laurence's Church, Ludlow, Shropshire.
During his years in London, A E Housman completed his cycle of 63 poems, A Shropshire Lad. After several publishers had turned it down, he published it at his own expense in 1896, much to the surprise of his colleagues and students. At first the book sold slowly, but Housman's nostalgic depiction of brave English soldiers struck a chord with English readers and his poems became a lasting success. Later, World War I had a further increasing effect on their popularity. Several composers, Arthur Somervell first, found inspiration in the seeming folksong-like simplicity of the poems. The most famous musical settings are by George Butterworth and Ralph Vaughan Williams, with others by Ivor Gurney, John Ireland and Ernest John Moeran.
Housman was surprised by the success of A Shropshire Lad because it, like all his poetry, is imbued with a deep pessimism and an obsession with all-pervasive death, with no place for the consolations of religion. Set in a half-imaginative pastoral Shropshire, "the land of lost content" (in fact Housman wrote most of the poems before ever visiting the place), the poems explore themes of fleetingness of love and decay of youth in a spare, uncomplicated style which many critics of the time found out of date compared with the exuberance of some of his late Victorian contemporaries. Housman himself acknowledged the influence of the songs of William Shakespeare, the Scottish Border Ballads and Heinrich Heine, but specifically denied any influence of Greek and Latin classics in his poetry.
In the early 1920s, when Moses Jackson was dying in Canada, Housman wanted to assemble his best unpublished poems together so that Jackson could read them before his death. These later poems, most of them written before 1910, show a greater variety of subject and form than those in A Shropshire Lad but also a certain lack of the kind of consistency found in the earlier poems. He published them as his Last Poems (1922) because he thought that his poetic inspiration was running out and that he would not publish any more poems in his lifetime. This proved true.
Housman's brother Laurence edited his posthumous poems which appeared in More Poems (1936) and Complete Poems (1939). In these poems, Housman appears more candid about his homosexuality and atheism than in his lifetime, though the essay De Amicitia, published by Laurence Housman in 1967, is even more revealing. Housman also wrote a parodic Fragment of a Greek Tragedy, in English, and humorous poems published posthumously under the title Unkind to Unicorns.
Housman's most familiar poem is surely "When I was one-and-twenty," number XIII from A Shropshire Lad. The Oxford Dictionary of Quotations includes no fewer than fourteen of its sixteen lines:
When I was one-and-twenty
I heard a wise man say,
"Give crowns and pounds and guineas
But not your heart away;
Give pearls away and rubies
But keep your fancy free."
But I was one-and-twenty,
No use to talk to me.
When I was one-and-twenty
I heard him say again,
"The heart out of the bosom
Was never given in vain;
'Tis paid with sighs a plenty
And sold for endless rue."
And I am two-and-twenty
And oh, 'tis true, 'tis true.
This poem is, in fact, a good example of the style and melancholy tone of the whole collection. Many of its poems dwell on mortality: "With rue my heart is laden/For golden friends I had,/For many a rose-lipt maiden/And many a lightfoot lad."
Poem XXVII, "Is my team ploughing?," is a dialogue between a dead youth and a friend who has survived him. The dead youth asks "Is my girl happy/That I thought hard to leave/And is she tired of weeping/As she lies down to eve?" The living replies "Ay, she lies down lightly/She lies not down to weep/Your girl is well contented/Be still, my lad, and sleep." As the reader has begun to suspect, two stanzas later the living man acknowledges "I cheer a dead man's sweetheart/Never ask me whose."
Poem LXII, "Terence, this is stupid stuff," is a dialogue in which the poet, asked for "a tune to dance to" instead of his usual "moping melancholy" verse, offers (perhaps ironically) the respite of drunkenness as a way to inure oneself to the pain of existence -- "Malt does more than Milton can/To justify God's ways to man" -- and pessimism as a longer-lasting immunization:
Therefore, since the world has still
Much good, but much less good than ill,
And while the sun and moon endure
Luck's a chance, but trouble's sure,
I'd face it as a wise man would,
And train for ill and not for good.
The uniform style and tone of A Shropshire Lad make it an easy target for parody, as in this example by Humbert Wolfe:
When lads have done with labor
in Shropshire, one will cry
"Let's go and kill a neighbor,"
and t'other answers "Aye!"
So this one kills his cousins,
and that one kills his dad;
and, as they hang by dozens
at Ludlow, lad by lad,
each of them one-and-twenty,
all of them murderers,
the hangman mutters: "Plenty
even for Housman's verse."
Another great poem by Housman, contrasting death with fleeting beauty and physical prowess, is the following:
To an Athlete Dying Young
By Alfred Edward Housman
The time you won your town the race
We chaired you through the market-place;
Man and boy stood cheering by,
And home we brought you shoulder-high.
Today, the road all runners come,
Shoulder-high we bring you home,
And set you at your threshold down,
Townsman of a stiller town.
Smart lad, to slip betimes away
From fields where glory does not stay
And early though the laurel grows
It withers quicker than the rose.
Eyes the shady night has shut
Cannot see the record cut,
And silence sounds no worse than cheers
After earth has stopped the ears:
Now you will not swell the rout
Of lads that wore their honors out,
Runners whom renown outran
And the name died before the man.
So set, before its echoes fade,
The fleet foot on the sill of shade,
And hold to the low lintel up
The still-defended challenge-cup.
And round the early-laureled head
Will flock to gaze the strengthless dead,
And find unwithered on its curls
The garland briefer than a girl’s
Housman is the main character in the 1998 Tom Stoppard play The Invention of Love.
Housman's poetry ("There's this to say for life and breath, it gives a man a taste for death") supplies the title and is quoted in the Peter O'Donnell Modesty Blaise thriller, A Taste for Death.
A Shropshire Lad is mentioned in E.M. Forster's A Room with a View: one of the characters, Reverend Beebe, picks up the book from a stack whilst visiting the Emerson home, and remarks "Never heard of it", perhaps lamenting the son's "unconventional" - if not sacrilegious - literary taste. 
Housman's poetry appealed to a significant number of British - and in particular English - composers in the first half of the 20th century. The national, pastoral and traditional elements of his style resonated with similar trends in English music. It is also suggested that the melancholy strain in the poems appealed to a generation of composers deeply influenced by the carnage of the first world war. George Butterworth, Ivor Gurney, John Ireland, C.W. Orr, Ethel Smyth, Arthur Somervell and Ralph Vaughan Williams all wrote Housman settings. Gerald Finzi repeatedly began settings, though never finished any. Even composers not normally associated with the pastoral tradition, such as Arnold Bax, Lennox Berkeley and Arthur Bliss, were attracted to Housman's poetry.
While Housman's poetry had a marked impact on British music, it has not been limited in its appeal by time, place or style. The American composer Samuel Barber set With rue my heart is laden. The contemporary New Zealand composer David Downes includes a setting of March on his CD The Rusted Wheel of Things. And Pierre Boulez's work Housman, qu'est-ce que c'est is based on What, still alive at twenty-two?
A wall hanging of A Shropshire Lad was created and now hangs prominently in the St Laurence Church, Ludlow, England. A plaque honouring the poet is also installed on the church grounds.