Wall area = room perimeter × ceiling height. A gallon typically covers ~350 ft² (32 m²) per coat. Plan for two coats, and add a primer coat for bare drywall or when going from a dark colour to a light one.
How much paint should you buy?
Wall area is the perimeter times height: 2 × (L + W) × height. We subtract standard allowances for doors (~21 sq ft) and windows (~15 sq ft), multiply by coats, and divide by ~350 sq ft per gallon. Enter dimensions in feet or meters — the tool converts.
Two coats is standard; buy a little extra for touch-ups.