National Records of Scotland (NRS) projects the population will rise slightly to 5.48 million in 2028 before falling to 5.39 million by 2045.
Currently, 5.47 million people live in Scotland.
If past trends in births, deaths and migration continue, then by 2045 there will be 200,000 fewer children – a fall of 22 per cent – and 300,000 more people over 65 (an increase of 30 per cent).
If the projections from NRS are realised, Scotland’s population will fall by 1.5 per cent over the next 25 years, whilst the UK population will grow 5.8 per cent.
NRS head of population and migration statistics Esther Roughsedge said: “Birth rates have been falling steadily for a number of years.
“Lower birth rates are the main reason these projections are lower than previous ones.
“Life expectancy has stalled since 2012-14 and Covid-19 has had some impact.
“But most of the projected change is due to longer-terms trends showing more deaths than births each year.
“As has been the case since mid-2001, more people are projected to move to Scotland than leave each year, but beyond 2028 this will no longer offset the gap between births and deaths.
“This is the main reason for these figures showing Scotland’s population peaking in the next decade before falling.
“Projections look at what will happen if current and recent trends continue into the future.
“These statistics are a useful guide for those involved in planning services for the future.
“A fall in the number of children and increases in the number of older people will change the pattern of demand for services like schools, health and social care.”
Age Scotland said the significant increase in people of pension age projected over the next two decades meant urgent action was needed to make Scotland fit for the future.
Charity chief executive Brian Sloan said: “Even before the pandemic, our health and social care services faced immense pressure and now they’re being stretched to breaking point.
"If we are to deliver on the health care needs of older people both now and in the future, more investment and resources will be needed."
The NRS report is based on data from the Office for National Statistics.