The emergency services were alerted to the blaze in a ground floor property in Restalrig Crescent, Edinburgh, just before 3.20am on Saturday.
Seventeen people, prompted by the sound of an alarm, managed to get out of the block before fire crews arrived on the scene.
Six people were given oxygen and three of those were later taken to hospital, the Scottish Fire and Rescue Service (SFRS) said.
A spokesman said: “We were alerted at 3.19am on Saturday to a fire within a ground floor flat at Restalrig Crescent, Edinburgh.
“Three appliances and a height appliance attended and extinguished the fire using a high-pressure hose reel.
“Seventeen residents had evacuated prior to our arrival.
“Six casualties were given oxygen therapy by the fire service and ambulance crews. Three of these casualties were subsequently taken to the Edinburgh Royal Infirmary.”
Join our Facebook group Our Edinburgh to share images and news from and around the Capital