The CIA (Central Intelligence Agency) mostly operates outside the United States to gather intelligence via a network of spies whereas the FBI (Federal Bureau of Investigation) predominantly operates within the U.S. to both gather intelligence as well as tackle federal crimes.
Contents: CIA vs FBI
The Office of Strategic Services (OSS) was the forerunner to the CIA. It was an intelligence agency established in 1942 during World War II but was abolished after the war and its functions were transferred to the State and War Departments. In 1947, President Truman signed the National Security Act of 1947 establishing the CIA. The National Security Act charged the CIA with coordinating the nation’s intelligence activities and correlating, evaluating and disseminating intelligence affecting national security.
The FBI originated from a force of special agents created in 1908 by Attorney General Charles Bonaparte during the presidency of Theodore Roosevelt. This was at a time when progressivism in America was on the rise and there was a need for interstate law enforcement. The first FBI agents were actually Secret Service agents. The agency was called the Bureau of Investigation when it was founded. In 1932, it was renamed the United States Bureau of Investigation, in 1933 it was named Division of Investigation (DOI) and in 1935 it was named the Federal Bureau of Investigation (FBI). J. Edgar Hoover became the first FBI Director and served for 48 years. Later legislation was passed and FBI director could hold tenure of 10 years only. 
edit Mission and Functions
As a "threat-based and intelligence-driven national security organization", the FBI's mission is "to protect and defend the United States against terrorist and foreign intelligence threats, to uphold and enforce the criminal laws of the United States, and to provide leadership and criminal justice services to federal, state, municipal, and international agencies and partners."
The FBI is primarily a law enforcement agency, collecting intelligence related to domestic security as well as investigating federal crimes such as kidnapping, tax evasion, securities fraud. They're basically the "national police department". The role of FBI is largely reactive in nature whereas CIA spies may work in foreign countries to prevent national security threats from materializing. However, counter-terrorism, counter-intelligence, cyber-warfare, public corruption, the duties of protecting civil rights, dealing with racketeering, frauds, drugs and other serious crimes also come under FBI's umbrella of responsibilities.
The CIA’s primary mission is to "collect, evaluate, and disseminate foreign intelligence to assist the president and senior US government policymakers in making decisions relating to the national security. The CIA does not make policy; it is an independent source of foreign intelligence information for those who do. The CIA may also engage in covert action at the president's direction in accordance with applicable law".
The CIA is an international intelligence agency. It gathers national security information related to foreign governments, non-state actors, corporations, and individuals, and provides this information to the US government. The CIA also provides intelligence to inform combat operations of the US armed forces in countries like Iraq and Afghanistan. The agency is also notorious for allegations of engineering coups in countries where rulers (usually dictators) are unfriendly toward the U.S. and even for assassinations of such leaders. For example, Fidel Castro of Cuba.
edit Organizational Structure
The CIA has an executive office and four major directorates:
- The Directorate of Intelligence, responsible for all-source intelligence research and analysis
- The National Clandestine Service, which does clandestine intelligence collection and covert action
- The Directorate of Support, provides necessary "housekeeping" administration functions.
- The Directorate of Science and Technology, creates and applies innovative technology in support of the intelligence collection mission.
The number of employees is classified but is estimated to be is about 20,000.
The FBI is part of the Justice Dept. It is organized into the Office of the Director(which handles administrative functions) and five functional branches:
- National Security Branch
- Criminal, Cyber, Response, and Services Branch
- Human Resources Branch
- Science and Technology Branch
- Information and Technology Branch
edit Joining the CIA or FBI
To join the CIA you must be a US citizen above 18 years of age and a high school graduate. A college degree is required for being an overseas officer, intelligence analyst, and for other non-clerical positions. Knowledge of a foreign language is also helpful. Watch video: Former CIA Spy Speaks Out.
To join the FBI, you must be a US citizen with no criminal record, a four-year college degree and pass a background test. There may also be a physical fitness test and polygraph test. Selected applicants undergo 21 weeks of training at the FBI academy.