The two-time world champion is set to make a full-time switch to the Indy Car series.
McLaren announced Alonso’s decision on Tuesday, mid-way through F1’s summer break, with the Spaniard saying he had made his mind up earlier this year but leaving the door open for a future return.
Alonso has been debating his grand prix future amid frustration over an uncompetitive second spell with McLaren and the monopoly over results by the teams at the front.
“After 17 wonderful years in this amazing sport, it’s time for me to make a change and move on,” he said.
“I have enjoyed every single minute of those incredible seasons and I cannot thank enough the people who have contributed to make them all so special.
“There are still several grands prix to go this season, and I will take part in them with more commitment and passion than ever.”
Alonso was allowed to miss the 2017 Monaco Grand Prix to make his Indianapolis 500 debut, and he challenged for victory in the famous IndyCar race before retiring.
McLaren said he was not allowed to repeat his Indy bid this season, but did give Alonso permission to combine his F1 efforts with a full World Endurance Championship superseason campaign.
Alonso went on to win the Le Mans 24 Hours at the first attempt with Toyota.
With two Monaco GP wins under his belt, Alonso’s Le Mans victory leaves just Indy unconquered in his bid for motorsport’s unofficial ‘triple crown’.
Alonso has not confirmed what he will be doing next season instead.
“Let’s see what the future brings; new exciting challenges are around the corner,” he said.
Alonso is extremely unlikely to add to his tally of 32 grand prix victories before he leaves F1 at the end of the year, and is just three shy of hitting 100 podiums.
He will surpass Jenson Button and Michael Schumacher in the list of all-time starts as he should end the year with 311 GP starts, which would only be surpassed by Rubens Barrichello’s 322.
McLaren boss Zak Brown said: “His 17 years in the sport, as arguably the pre-eminent driver of his generation and undoubtedly an F1 great, have added another layer to Formula 1’s rich history.
“There is a time for everyone to make a change and Fernando has decided the end of this season to be his. We respect his decision, even if we believe he is in the finest form of his career. Our open dialogue with Fernando has meant we could plan for this eventuality.”
McLaren have not yet said who will replace Alonso in 2019.