The answer to the question depends on your definition of a computer.
The first known counting devices or tools were Tally Sticks from about 35,000 BC.
The Abacus was then invented by the Babylonians in 2400 BC.
Charles Babbage’s Analytical Engine
In 1837, Charles Babbage, a British professor of mathematics described his idea for the Analytical Engine, the first stored-program mechanical computer. The Analytical Engine was designed to be powered by a steam engine and was to use Punched Cards, which was used to program mechanical looms at the time.
What made the Analytical Engine unique was that it was designed to be programmed.
It was because of this and the fact that it would be more than 100 years that any similar devices would be constructed, Charles Babbage, would be considered by many as the “father of computing”.
Because of legal, financial, and political obstacles, the Analytical Machine would never be completed. Charles Babbage was also difficult to work with and alienated the supporters of his work.
The first automatic electronic digital computer
In 1939, John V. Atanasoff and Clifford Berry developed the Atanasoff-Berry Computer (ABC) at Iowa State University, which was regarded as the first electronic digital computer. The ABC was built by hand and the design used over 300 Vacuum Tubes and had capacitors fixed in a mechanically rotating drum for memory.
The ENIAC (Electronic Numerical Integrator and Computer), constructed in the US in 1943, is widely regarded as the first functional programmable electronic computer.
John Mauchly and J. Presper Eckert are both credited as inventors of the ENIAC.
Influenced by the ABC, it was a turning point in the history of computing and was used to perform ballistics trajectory calculations and used 160 kW of power. World War II is known to be the driving force of computing hardware development and one of such use of computers was in communications encryption and decryption.
The UNIVAC I (Universal Automatic Computer) was the first commercially available, “mass produced” electronic computer manufactured by Remington Rand in the USA and was delivered to the US Census Bureau in June 1951. It used 5,200 vacuum tubes and consumed 125 kW of power.
46 machines were sold at more than $1 million each.
The microprocessor eventually led to the development of the microcomputer, small, low-cost computers that individuals and small businesses could afford.
By the 1990s, the microcomputer or Personal Computer (PC) became a common household appliance, and became even more widespread with the advent of the Internet.
Timeline of computer devices
80000 BC – Two notched rib bones may have been used for counting but they could have been merely decorative.
2400 BC – The abacus is the first known calculator, was probably invented by the Babylonians, and is still widely used by merchants, traders and clerks in Asia, Africa, and elsewhere.
1000 AD – The Planisphere was a mechanical computing device invented by Abu Rayhan al-Biruni.
1622 – Slide rules based on natural logarithms by John Napier were developed by William Oughtred.
1623 – A mechanical calculating machine was invented by Wilhelm Schickard from Germany.
1820 – Charles Xavier Thomas de Colmar created what would become the first mass-produced mechanical calculator called the Arithmometer.
1890 – Herman Hollerith a U.S. Census Department employee invented data storage on machine readable punched cards. He founded the Tabulating Machine Company, which later became IBM (International Business Machines).
1901 – The first 10-key adding machine was released for sale by the Standard Adding Machine Company in St. Louis, Missouri. A breakthrough for its time, the invention won an international grand prize during the 1904 World’s Fair.
1938 – Konrad Zuse from Germany built the first mechanical binary programmable computer called the Z1. It was based on Boolean Algebra and used floating-point arithmetic.
1946 – The ENIAC was unveiled. It could do 50,000 basic calculations a second and had 18,000 electronic valves.
1948 – The Curta was a small, hand-cranked mechanical calculator introduced by Austrian inventor, Curt Herzstark. It was a descendant of Gottfried Leibniz’s Stepped Reckoner and Thomas’s Arithmometer.
1951 – The Ferranti Mark 1 was the first commercial computer and was delivered to the University of Manchester. It was based on the Manchester Mark 1.
1951 – The first “mass produced” computer, the UNIVAC I (Universal Automatic Computer) was delivered to the U.S. Census Bureau.
1952 – IBM publicly announced its first mainframe computer, the IBM 701 Electronic Data Processing Machine.
1953 – The first computer built with transistors was designed and completed at the University of Manchester.
1961 – The British Bell Punch ANITA was the first all-electronic desktop calculator. It was silent and quick, and used vacuum tubes, 12 cold-cathode “Nixie” tubes for its display, and Dekatrons.
1964 – The first supercomputer, the CDC 6600, was released. With performance of about 1 megaFLOPS, it outperformed its predecessor, the IBM 7030 Stretch, by about a factor of three.
1965 – The first minicomputer, built by Digital Equipment (DEC) was made available to the public. The DEC PDP-8 Mini Computer cost US$16,000.
1969 – ARPANET developed by the U.S. Department of Defense for research became the technical foundation of the Internet.
1971 – The first single-chip microprocessor, the 4004, was designed by Ted Hoff, Federico Faggin, and Stanley Mazor at Intel.
1975 – The world’s first complete, pre-assembled personal computer system, the P6060, was unveiled by Olivetti at the Hannover Fair. It had 8″ floppy disk drives, a 32-character plasma display, 48 Kbytes of RAM, and weighed 40 kg (88 lb).
1977 – The Apple II computer was introduced based on an 8-bit microprocessor running at 1 MHz with 4 KB of RAM. It had color graphics, and an audio cassette interface for loading programs and data storage.
1980 – Tandy released the TRS-80 Color Computer, which used Microsoft Basic as its programming language. It supported cartridge programs and games, attempting to bridge both the home computing and video gaming markets.
1981 – IBM announced their IBM Personal Computer (PC) running MS-DOS 1.0.
1994 – IBM introduced the first PDA with full mobile phone functionality, the IBM Simon, which can also be considered the first smartphone.
1997 – PDAs (Personal digital assistant) gained widespread popularity. Manufacturers included HP, Nokia, Palm, Inc. (Palm Pilot)
2007 – The iPhone was introduced by Apple. One of the first full-featured smartphones, it had a touchscreen, a full-featured web browser to access the World Wide Web (WWW).