The most common way to measure the mass of an object in grams is to use a scale or balance. Techniques vary but are generally similar to measuring weight. In a laboratory setting, more sophisticated measurement instruments such as analytical balances are used.
Mass is defined as the total amount of matter in an object or as the gravitational attraction of one object to other objects. Although it is different from weight, it is measured similarly because mass = weight x gravity, and gravity is constant on the Earth's surface. While weight would vary on another planet or in outer space, the mass of an object would remain the same regardless of location.