The men were part of a rampaging mob that set a house on fire and prevented the mostly women and children inside from escaping during religious riots in western India in 2002.
The weekslong riots in Gujarat state were sparked by a train fire that killed 60 Hindus and was blamed on Muslims. More than 1,000 people, mostly Muslims, died or went missing as Hindu mobs rampaged through towns and villages. Tens of thousands were left homeless as rioters set fire to Muslim homes and businesses.
Last week, after a four-year-long investigation, the special court found the 18 guilty of setting on fire the house in Ode village where the Muslims had taken shelter.
District Judge Poonam Singh sentenced them to life imprisonment for murder and five other men to seven years in prison for rioting in Ode and chasing Muslims from their homes.
The attorney for the 18 men, Ashwin Dhagad, said they would appeal the sentence to a higher court.
Rights groups and survivors accused the Gujarat government, led by Chief Minister Narendra Modi of the Hindu right-wing Bharatiya Janata Party, of not doing enough to stop the riots.
Earlier this week, a Gujarat court said that a special investigating team had found no evidence linking Modi to another massacre in which 69 people were killed in an apartment complex in the state capital during the 2002 riots. The widow of a prominent Muslim leader killed in that attack had accused Modi of not responding to repeated phone calls for help.