In more detail
The energy values are the Atwater factors: protein and carbohydrate 4 kcal per gram, fat 9 (see Calorie). Alcohol supplies 7 kcal per gram but is not a nutrient the body needs. Fibre is counted as carbohydrate on US labels yet yields only about 2 kcal per gram, which is why some labels list it separately. For adults, the US Acceptable Macronutrient Distribution Ranges are 45 to 65% of energy from carbohydrate, 20 to 35% from fat and 10 to 35% from protein, and the protein RDA is 0.8 g per kg of body weight per day.
Why it matters
Splitting a calorie target into grams turns percentages into something you can weigh and log. The same percentage means very different grams at different intakes, so check both. Needs change with training, pregnancy, age and conditions such as kidney disease or diabetes, where a dietitian or doctor should set the targets.
Example
2,000 kcal split 30 % protein / 40 % carbohydrate / 30 % fat
Protein: 600 kcal / 4 = 150 g
Carbs: 800 kcal / 4 = 200 g
Fat: 600 kcal / 9 = 66.7 g
Label check: 12 g protein, 45 g carbs, 8 g fat = 48 + 180 + 72 = 300 kcal