He made large theoretical contributions to computer science in the 1930s, before any actual computers were built. He invented the Turing Machine, a mathematical model of a computing system that is still widely used, and used it to solve the halting problem, the computer science analogue of Kurt Gödel's Incompleteness Theorem. This, together with work by Alonzo Church, under whom Turing later did a PhD at Princeton University, led to the Church-Turing Thesis about undecidability of certain questions.
During the Second World War, Turing was one of the key codebreakers on the British ULTRA project which read many German codes throughout the war. He contributed to the design of the Colossus computer, was deeply involved in mechanised attacks on the Enigma machine ciphers and was primarily responsible for breaking the four-rotor U-boat enigma. He was also sent to the US as a top-level cryptographic liaison, working with people like John von Neumann and Claude Shannon.
After the war, Turing was involved in building one of the world's first civilian digital computers at Manchester University. He also continued theoretical work and, in a 1950 paper titled "Computing Machinery and Intelligence", was among the first to ask "Can machines think?" As a partial answer, he proposed the Turing test for successful artificial intelligence. If a sceptic cannot distinguish a computer from a human by having a conversation with it, then he must admit the computer behaves intelligently.
Turing was homosexual and, in 1952, was prosecuted for this and forced to undergo hormonal "therapy" for his "condition". With McCarthyism in full swing in America and intelligence services throughout the Western world feeling more than usually paranoid, this threatened his career. In 2009, UK Prime Minister Gordon Brown expressed his regrets for his treatment. Turing died of cyanide poisoning in 1954. The coroner ruled that it was suicide, but the verdict has been questioned Turing was an amateur chemist and it is possible he died from accidentally inhaling cyanide rather than deliberately swallowing it.
On 24 December 2013, Turing was granted a royal pardon which cancelled his conviction for homosexuality, under the Royal Prerogative of Mercy following a request by Justice Minister Chris Grayling.
Turing is commemorated in several ways:
- The Association for Computing Machinery Turing Award, the "Nobel Prize of computing", the highest technical award in the field; 
- the Loebner Prize is given for progress toward passing the Turing test; 
- Manchester University, Turing Lectures; 
- Turing memorial in Manchester; 
- a stream cipher named Turing;
- a number of celebrations were planned for around the hundredth anniversary of his birth, 23 June 2012.  In particular, Manchester hosted an Alan Turing Centenary Conference. 
- The 2014 British government budget includes Alan Turing Institute to be set up to research big data
- Alan Turing (1950). Computing Machinery and Intelligence.
- Gordon Brown (10 September 2009), Treatment of Alan Turing was “appalling” - PM, Office of the U.K. Prime Minister
- "Turing suicide enigma challenged", The Guardian
- Staff writer. Royal pardon for codebreaker Alan Turing, BBC News, British Broadcasting Corporation, 24 December 2013. Retrieved on 24 December 2013.
- Rose, Gregory J.; Philip Hawkes (2003). “Turing: A Fast Stream Cipher”, Lecture Notes in Computer Science: Fast Software Encryption. Springer, 290-306. DOI:10.1007/978-3-540-39887-5_22. ISBN 978-3-540-20449-7.