Firefighters were called to the property in Stainland Road, Elland, at about 12.50am today (Tuesday).
Two men inside were suffering from smoke inhalation, a spokesman for West Yorkshire Fire and Rescue Service said.
They were taken to hospital by ambulance.
The spokesman said the fire started in the kitchen.
Crews used two hose reels and four breathing apparatus.