There are exactly 231 cubic inches in a US liquid gallon. To convert from cubic inches to gallons, multiply by (1 gallon/(231 in3)). The conversion factor is different for other definitions of gallon.
Example
1 ft3 = (12 in)3 = 1728 in3
= (1728 in3)*(1 gal/(231 in3)) = (1728/231) gal
= 7.480519 gal (the underlined digits repeat indefinitely)
= 7 37/77 gal
Example
1 ft3 = (12 in)3 = 1728 in3
= (1728 in3)*(1 gal/(231 in3)) = (1728/231) gal
= 7.480519 gal (the underlined digits repeat indefinitely)
= 7 37/77 gal