William's Kensington Palace office said that the second in line to the British throne completed his final shift earlier this week.
It said he will now focus on royal duties and is "considering a number of options for public service."
The palace said William, 31, would "expand his work in the field of conservation, particularly in respect of endangered species" and would work on charities that help children and veterans.
William has spent more than seven years in the military, first in the army and then as a Royal Air Force pilot, stationed on the quiet island of Anglesey in north Wales.
He was able to blend in with residents and fellow military personnel, enjoying a degree of privacy despite his royal status.
In July his wife Kate gave birth to the couple's first child, Prince George. Now that William's active military career is finished, the family will move into refurbished quarters at Kensington Palace in London. They had been living in a rented home in Anglesey.
William started as an officer cadet at Sandhurst military academy in 2006. He started search and rescue helicopter training three years later.
The palace said he had participated in 156 search and rescue operations, helping to rescue 149 people. He has completed more than 1,300 flying hours.
William's younger brother, Prince Harry, remains active in the military, and has served in Afghanistan as an Apache helicopter pilot.
Take ABC13 with you!
Download our free apps for iPhone, iPad, and Android devices