Forester was born in Cairo and, after a family breakup at an early age, moved with his mother to London, where he was educated at Alleyn's School and Dulwich College, south London. At Alleyn's he may have been a contemporary of E. S. Hornblower, who died on active service with the Canadian Infantry in 1917. It is possible that as Cecil L. T. Smith and an Old Boy he would have been present at the unveiling of the War Memorial panels which are still on display where he would have read the name "Hornblower". He began to study medicine at Guy's Hospital, London, but left without completing his degree. Forester had always worn glasses and been thin. Trying to enlist in the army, he failed his physical and was told there was not a chance that he would be accepted, even though he was of good height and somewhat athletic. Around 1921, after leaving Guy's, he began writing seriously using his pen name.
During World War II, Forester moved to the United States where he worked for the British Information Service and wrote propaganda to encourage the US to join the Allies. He eventually settled in Berkeley, California. While living in Washington, D.C., he met a young British intelligence officer named Roald Dahl in early 1942, whose experiences in the RAF he had heard about, and encouraged him to write about them. According to Dahl's autobiographical Lucky Break, Forester asked Dahl about his experiences as a fighter pilot. This prompted Dahl to write his first story, "A Piece of Cake".
Forester wrote many novels. He is best known for the 12-book Horatio Hornblower series, depicting a Royal Navy officer during the Napoleonic wars. He began the series with Hornblower fairly high in rank in the first novel, published in 1937. The last completed novel was published in 1962. With demand for more stories, Forester filled in Hornblower's life story, in effect. Hornblower's fictional feats were based on real events, but Forester wrote the body of the works carefully to avoid entanglements with real world history, so that Hornblower is always off on another mission when a great naval victory occurs during the Napoleonic Wars.
Forester's other novels include The African Queen (1935) and The General (1936); Peninsular War novels in Death to the French (published in the United States as Rifleman Dodd) and The Gun (filmed as The Pride and the Passion in 1957); and seafaring stories that did not involve Hornblower, such as Brown on Resolution (1929), The Captain from Connecticut (1941), The Ship (1943), and Hunting the Bismarck (1959), which was used as the basis of the screenplay for the film Sink the Bismarck! (1960). Several of his works were filmed, including The African Queen (1951), directed by John Huston. Forester is also credited as story writer for several movies not based on his published fiction, including Commandos Strike at Dawn (1942).
He wrote several volumes of short stories set during the Second World War. Those in The Nightmare (1954) were based on events in Nazi Germany, ending at the Nuremberg trials. Stories in The Man in the Yellow Raft (1969) followed the career of the destroyer USS Boon, while many of those in Gold from Crete (1971) followed the destroyer HMS Apache. The last of the stories in Gold from Crete was "If Hitler had invaded England", which offers an imagined sequence of events starting with Hitler's attempt to implement Operation Sea Lion, and culminating in the early military defeat of Nazi Germany in the summer of 1941. His non-fiction seafaring works include The Age of Fighting Sail (1956), an account of the sea battles between Great Britain and the United States in the War of 1812.
In addition to his novels of seafaring life, Forester published two crime novels (Payment Deferred (1926) and Plain Murder (1930)) and two children's books. Poo-Poo and the Dragons (1942) was created as a series of stories told to his younger son George to encourage him to finish his meals. George had mild food allergies that kept him feeling unwell, and he needed encouragement to eat. The Barbary Pirates (1953) is a children's history of early 19th-century pirates.
C. S. Forester appeared as a contestant on the TV quiz program You Bet Your Life, hosted by Groucho Marx, in an episode broadcast on 1 November 1956.
A "lost" novel of Forester's, The Pursued, was discovered in 2003 and bought at an auction and was published by Penguin Classics on 3 November 2011.
He married Kathleen Belcher in 1926 and they had two sons, John and George Forester. The couple divorced in 1945. In 1947, he married Dorothy Foster. John Forester wrote a two-volume biography of his father, including many elements of Forester's life which only became clear to his son after his death.