All residents were treated by the ambulance service but did not need to go to hospital.
The Red Cross were also on scene helping residents
Around 30 firefighters attended to the blaze which broke out at around 7.50pm in Clerk Street in Edinburgh.
It is understood the fire in the basement of the five-storey building and spread to the three floors above.
Parts of Clerk Street and Nicolson Street were closed to traffic as police set up diversions.
A spokeswoman for Lothian and Borders Fire and Rescue Service said: “Fortunately the rapid response from firefighters meant that they were able to lead those at risk from the fire to safety.
“This was a serious fire which required a number of resources to put out the blaze, prevent further spread to nearby properties and ensure that all the occupants of the building were safe.
“Whilst the cause of the fire is now under investigation we would like to remind people to ensure that basement areas are not used to store rubbish or combustibles that could be set alight.
“If you live in a tenement with a common stair, make sure access is controlled by keeping the front door locked. Keep stairwells clear of debris or equipment that could block escape routes in an emergency.
“Homeowners should also ensure they have a working smoke detector in their property. If fire does break out it will give you vital early warning of danger, time to contact the emergency services and get out of the property. You can arrange a free home safety visit and fitting of a smoke alarm by calling 0800 169 0320.”