GCHQ was originally established after the First World War as the Government Code and Cypher School (GC&CS) and was known under that name until 1946. During the Second World War it was located at Bletchley Park, where it was famed for its role in the breaking of the German Enigma codes. Currently there are two main components of the GCHQ, the Composite Signals Organisation (CSO), which is responsible for gathering information, and the CESG, which is responsible for securing the UK's own communications. The Joint Technical Language Service (JTLS) is a small department and cross-government resource responsible for mainly technical language support and translation and interpreting services across government departments. It is co-located with GCHQ for administrative purposes.

During the First World War, the United Kingdom's Army and Navy had separate signals intelligence agencies, MI1b and NID25 (initially known as Room 40) respectively.[6][7] In 1919, the Cabinet's Secret Service Committee, chaired by Lord Curzon, recommended that a peace-time codebreaking agency should be created, a task given to the then-Director of Naval Intelligence, Hugh Sinclair.[8] Sinclair merged staff from NID25 and MI1b into the new organisation, which initially consisted of around 25–30 officers and a similar number of clerical staff.[9] It was titled the "Government Code and Cypher School", a cover-name chosen by Victor Forbes of the Foreign Office.[10]Alastair Denniston, who had been a member of NID25, was appointed as its operational head.[8] It was initially under the control of the Admiralty, and located in Watergate House, Adelphi, London.[8] Its public function was "to advise as to the security of codes and cyphers used by all Government departments and to assist in their provision", but also had a secret directive to "study the methods of cypher communications used by foreign powers".[11] GC&CS officially formed on 1 November 1919,[12] and produced its first decrypt on 19 October.[8]

Allidina Visram school in Mombasa, pictured above in 2006, was the location of the British "Kilindini" codebreaking outpost during World War II

Before the Second World War, GC&CS was a relatively small department. By 1922, the main focus of GC&CS was on diplomatic traffic, with "no service traffic ever worth circulating"[13] and so, at the initiative of Lord Curzon, it was transferred from the Admiralty to the Foreign Office.[14] GC&CS came under the supervision of Hugh Sinclair, who by 1923 was both the Chief of SIS and Director of GC&CS.[8] In 1925, both organisations were co-located on different floors of Broadway Buildings, opposite St. James's Park.[8] Messages decrypted by GC&CS were distributed in blue-jacketed files that became known as "BJs".[15]

In the 1920s, GC&CS was successfully reading Soviet Union diplomatic ciphers. However, in May 1927, during a row over clandestine Soviet support for the General Strike and the distribution of subversive propaganda, Prime Minister Stanley Baldwin made details from the decrypts public.[16]

GCHQ was at first based in Eastcote, but in 1951[20] moved to the outskirts of Cheltenham, setting up two sites there – Oakley and Benhall. GCHQ had a very low profile in the media until 1983 when the trial of Geoffrey Prime, a KGB mole within GCHQ, created considerable media interest.[21]

Since the days of the Second World War, US and British intelligence have shared information. For the GCHQ this means that it shares information with, and gets information from, the National Security Agency (NSA) in the United States.[22]

Early in the 1970s, the concept for public key encryption was developed and proven by James H. Ellis, a GCHQ staff member since 1952, who lacked the necessary number theory expertise necessary to build a workable system. Subsequently a feasible implementation scheme via an asymmetric key algorithm was invented by another staff member Clifford Cocks, a mathematics graduate. This fact was kept secret until 1997.[23]

In 1984, GCHQ was the centre of a political row when the Conservative government of Margaret Thatcher prohibited its employees from belonging to a trade union. It was claimed that joining a union would be in conflict with national security. A number of mass national one-day strikes were held to protest this decision, seen as a first step to wider bans on trade unions. Appeals to British Courts and European Commission of Human Rights[24] were unsuccessful. The government offered a sum of money to each employee who agreed to give up their union membership. Appeal to the ILO resulted in a decision that government's actions were in violation of Freedom of Association and Protection of the Right to Organise Convention.[25] The ban was eventually lifted by the incoming Labour government in 1997, with the Government Communications Group of the Public and Commercial Services (PCS) Union being formed to represent interested employees at all grades.[26] In 2000, a group of 14 former GCHQ employees, who had been dismissed after refusing to give up their union membership, were offered re-employment, which three of them accepted.[27]

The Intelligence Services Act 1994 placed the activities of the intelligence agencies on a legal footing for the first time, defining their purpose, and the British Parliament's Intelligence and Security Committee was given a remit to examine the expenditure, administration and policy of the three intelligence agencies.[28] The objectives of GCHQ were defined as working as "in the interests of national security, with particular reference to the defence and foreign policies of Her Majesty's government; in the interests of the economic wellbeing of the United Kingdom; and in support of the prevention and the detection of serious crime".[29] During the introduction of the Intelligence Agency Act in late 1993, the former Prime Minister Jim Callaghan had described GCHQ as a "full blown bureaucracy", adding that future bodies created to provide oversight of the intelligence agencies should "investigate whether all the functions that GCHQ carries out today are still necessary."[30]

In 1993, in the wake of the "Squidgygate" affair, GCHQ denied "intercepting, recording or disclosing" the telephone calls of the British Royal family.[31]

In late 1993 civil servant Michael Quinlan advised a deep review of the work of GCHQ following the conclusion of his "Review of Intelligence Requirements and Resources", which had imposed a 3% cut on the agency.[32] The Chief Secretary to the Treasury, Jonathan Aitken, subsequently held face to face discussions with the intelligence agency directors to assess further savings in the wake of Quinlan's review. Aldrich (2010) suggests that Sir John Adye, the then Director of GCHQ performed badly in meetings with Aitken, leading Aitken to conclude that GCHQ was "suffering from out-of-date methods of management and out-of-date methods for assessing priorities".[33] GCHQ's budget was £850 million in 1993, (£1.51 billion) as of 2015)[34] compared to £125 million for MI5 and SIS. In December 1994 the businessman Roger Hurn was commissioned to begin a review of GCHQ, which was concluded in March 1995.[35] Hurn's report recommended a cut of £100 million in GCHQ's budget, such a large reduction had not been suffered by any British intelligence agency since the end of World War II.[35] The J Division of GCHQ, which had collected SIGINT on Russia, disappeared as result of the cuts.[35] The cuts had been mostly reversed by 2000 in the wake of threats from violent non-state actors, and risks from increased terrorism, organised crime and illegal access to nuclear, chemical and biological weapons.[36]

David Omand became the Director of GCHQ in 1996, and greatly restructured the agency in the face of new and changing targets and rapid technological change.[37] Omand introduced the concept of "Sinews" (or "SIGINT New Systems") which allowed more flexible working methods, avoiding overlaps in work by creating fourteen domains, each with a well-defined working scope.[37] The tenure of Omand also saw the planning and the creation of The Doughnut, GCHQ's modern headquarters.[37] Located on a 176-acre site in Benhall, near Cheltenham, The Doughnut would be the largest building constructed for secret intelligence operations outside the United States.[38]

Operations at GCHQ’s Chum Hom Kwok listening station in Hong Kong ended in 1994.[39] GCHQ's Hong Kong operations were extremely important to their relationship with the NSA, who contributed investment and equipment to the station. In anticipation of the transfer of Hong Kong to the Chinese government in 1997, the Hong Kong stations operations were moved to Geraldton in Australia.[40]

At the end of 2003, GCHQ moved to a new circular HQ (popularly known as "The Doughnut"): at the time, it was the second-largest public-sector building project in Europe, with an estimated cost of £337 million. The new building, which was designed by Gensler and constructed by Carillion,[43] is the base for all of GCHQ's Cheltenham operations.

In March 2010, GCHQ was criticised by the Intelligence and Security Committee for problems with its IT security practices and failing to meet its targets for work targeted against cyber attacks.[47]

As revealed by Edward Snowden in The Guardian, GCHQ spied on foreign politicians visiting the 2009 G-20 London Summit by eavesdropping phonecalls, emails and monitoring their computers, and in some cases even ongoing after the summit via keyloggers that had been installed during the summit.[48] Some of the information gained has been passed on to British politicians.

According to Edward Snowden, GCHQ has two principal umbrella programs for collecting communications:

"Mastering the Internet" (MTI) for internet traffic, which is extracted from fiber-optic cables and can be searched by using the Tempora computer system.

GCHQ also has had access to the US internet monitoring programme PRISM since at least June 2010.[50] PRISM is said to give the National Security Agency and FBI easy access to the systems of nine of the world's top internet companies, including Google, Facebook, Microsoft, Apple, Yahoo, and Skype.[51]

In February 2014, The Guardian, based on documents provided by Snowden, revealed that GCHQ had indiscriminately collected 1.8 million private Yahoo webcam images from users across the world.[52]

Soon after becoming Director of GCHQ in 2014, Robert Hannigan wrote an article in the Financial Times on the topic of internet surveillance, stating that "however much [large US technology companies] may dislike it, they have become the command and control networks of choice for terrorists and criminals" and that GCHQ and its sister agencies "cannot tackle these challenges at scale without greater support from the private sector", arguing that most internet users "would be comfortable with a better and more sustainable relationship between the [intelligence] agencies and the tech companies". Since the 2013 global surveillance disclosures, large US technology companies have improved security and become less co-operative with foreign intelligence agencies, including those of the UK, generally requiring a US court order before disclosing data.[53][54] However the head of the UK technology industry group techUK rejected these claims, stating that they understood the issues but that disclosure obligations "must be based upon a clear and transparent legal framework and effective oversight rather than, as suggested, a deal between the industry and government".[55]

CESG (originally Communications-Electronics Security Group) is the group within GCHQ which provides assistance to government departments on their own communications security: CESG is the UK National Technical Authority for information assurance, including cryptography. CESG does not manufacture security equipment, but works with industry to ensure the availability of suitable products and services, while GCHQ itself can fund research into such areas, for example to the Centre for Quantum Computing at Oxford University and the Heilbronn Institute at the University of Bristol.[56]

The Joint Technical Language Service (JTLS) was established in 1955,[58] drawing on members of the small Ministry of Defence technical language team and others, initially to provide standard English translations for organisational expressions in any foreign language, discover the correct English equivalents of technical terms in foreign languages and discover the correct expansions of abbreviations in any language. The remit of the JTLS has expanded in the ensuing years to cover technical language support and interpreting and translation services across the UK Government and to local public sector services in Gloucestershire and surrounding counties. The JTLS also produces and publishes foreign language working aids under crown copyright and conducts research into machine translation and on-line dictionaries and glossaries.

(1) There shall continue to be a Government Communications Headquarters under the authority of the Secretary of State; and, subject to subsection (2) below, its functions shall be—

(a) to monitor or interfere with electromagnetic, acoustic and other emissions and any equipment producing such emissions and to obtain and provide information derived from or related to such emissions or equipment and from encrypted material; and

(b) to provide advice and assistance about—

(i) languages, including terminology used for technical matters, and

(ii) cryptography and other matters relating to the protection of information and other material, to the armed forces of the Crown, to Her Majesty's Government in the United Kingdom or to a Northern Ireland Department or to any other organisation which is determined for the purposes of this section in such manner as may be specified by the Prime Minister.

(2) The functions referred to in subsection (1)(a) above shall be exercisable only—

(a) in the interests of national security, with particular reference to the defence and foreign policies of Her Majesty's Government in the United Kingdom; or

(b) in the interests of the economic well-being of the United Kingdom in relation to the actions or intentions of persons outside the British Islands; or

(c) in support of the prevention or detection of serious crime.

(3) In this Act the expression "GCHQ" refers to the Government Communications Headquarters and to any unit or part of a unit of the armed forces of the Crown which is for the time being required by the Secretary of State to assist the Government Communications Headquarters in carrying out its functions.[60]

The Investigatory Powers Tribunal ruled in December 2014 that GCHQ does not breach the European Convention of Human Rights, and that its activities are compliant with Articles 8 (right to privacy) and 10 (freedom of expression) of the European Convention of Human Rights.[62] However, the Tribunal stated in February 2015 that one particular aspect, the data-sharing arrangement that allowed UK Intelligence services to request data from the US surveillance programmes Prism and Upstream, had been in contravention of human rights law prior to this until two paragraphs of additional information, providing details about the procedures and safeguards, were disclosed to the public in December 2014.[67][68][69]

Furthermore, the IPT ruled that the legislative framework in the United Kingdom does not permit mass surveillance and that while GCHQ collects and analyses data in bulk, it does not practice mass surveillance.[62][70][71] This complements independent reports by the Interception of Communications Commissioner,[72] and a special report made by the Intelligence and Security Committee of Parliament; although several shortcomings and potential improvements to both oversight and the legislative framework were highlighted.[73]

A controversial GCHQ case determined the scope of judicial review of prerogative powers (the Crown's residual powers under common law). This was Council of Civil Service Unions v Minister for the Civil Service [1985] AC 374 (often known simply as the "GCHQ case"). In this case, a prerogative Order in Council had been used by the prime minister (who is the Minister for the Civil Service) to ban trade union activities by civil servants working at GCHQ. This order was issued without consultation. The House of Lords had to decide whether this was reviewable by judicial review. It was held that executive action is not immune from judicial review simply because it uses powers derived from common law rather than statute (thus the prerogative is reviewable). Controversially, they also held that although the failure to consult was unfair, this was overridden by concerns of national security.

^Alvarez, David (2001). "Most Helpful and Cooperative: GC&CS and the Development of American Diplomatic Cryptanalysis, 1941-1942". In Smith, Michael; Erskine, Ralph. Action This Day: Bletchley Park from the Breaking of the Enigma Code to the Birth of the Modern Computer. Bantam Press. ISBN978-0593049105.

^"The Andrew Marr Show Interview: Theresa May, MP Home Secretary". BBC. 23 November 2014. Retrieved 6 December 2014. Well I guess what he’s talking about is the fact that for certain aspects and certain of the more intrusive measures that our security service and police have available to them – i.e. Intercept, intercepting people’s telephones and some other intrusive measures – the decision is taken by the Secretary of State, predominantly me. A significant part of my job is looking at these warrants and signing these warrants. I think it’s ... Some people argue that should be to judges....I think it’s very important that actually those decisions are being taken by somebody who is democratically accountable to the public. I think that’s an important part of our system. I think it’s a strength of our system.

^"List of judgments". Investigatory Powers Tribunal. 5 December 2014. Retrieved 7 February 2015. 1. A declaration that the regime governing the soliciting, receiving, storing and transmitting by UK authorities of private communications of individuals located in the UK which have been obtained by US authorities pursuant to Prism and/or Upstream does not contravene Articles 8 or 10 ECHR. 2. A declaration that the regime in respect of interception under ss8(4), 15 and 16 of the Regulation of investigatory Powers Act 2000 does not contravene Articles 8 or 10 ECHR and does not give rise to unlawful discrimination contrary to Article 14, read together with Articles 8 and/or 10 of the ECHR.

Johnson, John (1997). The Evolution of British Sigint: 1653–1939. HMSO. ASINB002ALSXTC.

Kahn, David (1991). Seizing the Enigma: The Race to Break the German U-Boats Codes, 1939–1943. Houghton Mifflin. ISBN978-0395427392.

Smith, Michael (2001). "GC&CS and the First Cold War". In Smith, Michael; Erskine, Ralph. Action This Day: Bletchley Park from the Breaking of the Enigma Code to the Birth of the Modern Computer. Bantam Press. ISBN978-0593049105.