I wanted to settle debates like "is chicken actually better than salmon?" with real numbers. So I pulled data from the USDA FoodData Central API and built a side-by-side comparison tool for 195 common foods.
The Setup
Every food is compared on 10 metrics per 100g serving:
- Calories, Protein, Fat, Carbs, Fiber, Sugar
- Vitamin C, Calcium, Iron, Potassium
The tool shows who "wins" each category and gives an overall winner based on total categories won.
5 Findings That Surprised Me
1. Broccoli Has Respectable Protein
At 2.8g protein per 100g with only 34 calories, broccoli has one of the best protein-to-calorie ratios among vegetables. It won't replace chicken breast (31g protein), but for a vegetable, it's surprisingly competitive.
2. Sweet Potato vs Regular Potato Is Closer Than You Think
Everyone assumes sweet potatoes are the "healthy" option. The data shows it's not that simple:
| Metric | Sweet Potato | Regular Potato |
|---|---|---|
| Calories | 86 | 77 |
| Protein | 1.6g | 2.0g |
| Fiber | 3.0g | 2.2g |
| Vitamin C | 2.4mg | 19.7mg |
| Potassium | 337mg | 425mg |
Regular potatoes actually win on protein, vitamin C, and potassium. Sweet potatoes win on fiber and vitamin A (not shown). It's a genuine toss-up depending on what you need.
3. Almonds vs Walnuts — Not What I Expected
Both are "healthy nuts" but they're surprisingly different:
- Almonds: 579 cal, 21g protein, 12g fiber, 269mg calcium
- Walnuts: 654 cal, 15g protein, 7g fiber, 98mg calcium
Almonds dominate on protein, fiber, and calcium. Walnuts win on omega-3s (not in our dataset, but worth noting).
4. Egg vs Tofu — The Complete Protein Debate
Per 100g: eggs have 13g protein at 155 cal, while tofu has 8g protein at 76 cal. But tofu has better protein-per-calorie ratio if you're counting. The "which is better" answer genuinely depends on your goals.
5. The Most Nutrient-Dense Foods Per Calorie
When you sort our 195 foods by nutrients-per-calorie, leafy greens dominate: spinach, kale, and watercress pack the most vitamins and minerals for the fewest calories. Not surprising, but the gap is bigger than I expected.
How I Built It
- Data: USDA FoodData Central SR Legacy dataset — 195 foods with complete nutrition profiles
- Framework: Astro generating static HTML (zero JavaScript, instant loads)
- Hosting: Cloudflare Pages (free)
- Pages: 18,900+ comparison pages (every possible pair of 195 foods)
The comparison tool lets you pick any two foods and see them side-by-side with visual bars showing who wins each metric.
Try It
The full tool is free at food-nutrition-3xm.pages.dev — search for any food, pick two, compare. There's also a random comparison button if you want to discover surprising matchups.
This is part of a series where I'm building free tools from government data APIs. The solar ROI calculator (using NREL data) was the first — nutrition was the second.
All nutrition data from USDA FoodData Central. Values per 100g serving.
Top comments (0)