When converting grams to gallons, you first need to know what the density of what you are measuring is. Grams are units of mass while gallons are units of volume. A liter of water weighs one kilogram, or one thousand grams, and a gallon is 3.78 liters, so a gallon of water would weigh around 3780 grams.