Alan Alexander Milne was born in Kilburn, London to parents John Vine Milne, who was born in England, and Sarah Marie Milne (née Heginbotham) and grew up at Henley House School, 6/7 Mortimer Road (now Crescent), Kilburn, a small independent school run by his father. One of his teachers was H. G. Wells, who taught there in 1889–90. Milne attended Westminster School and Trinity College, Cambridge where he studied on a mathematics scholarship, graduating with a B.A. in Mathematics in 1903. He edited and wrote for Granta, a student magazine. He collaborated with his brother Kenneth and their articles appeared over the initials AKM. Milne's work came to the attention of the leading British humour magazine Punch, where Milne was to become a contributor and later an assistant editor. Considered a talented cricket fielder, Milne played for two amateur teams that were largely composed of British writers: the Allahakbarries and the Authors XI. His teammates included fellow writers J. M. Barrie, Arthur Conan Doyle and P. G. Wodehouse.
After graduating from Cambridge University in 1903, A. A. Milne contributed humorous verse and whimsical essays to Punch, joining the staff in 1906 and becoming an assistant editor.