DEV Community

Botánica Andina
Botánica Andina

Posted on

I Built a Yerba Mate Caffeine Calculator That Accounts for Preparation Method

Most caffeine calculators treat yerba mate as a single item — "one cup = 85mg caffeine." But anyone who actually drinks mate knows that's wildly inaccurate. A traditional calabaza shared over an hour delivers a completely different caffeine profile than a quick mate cocido tea bag.

So I built a calculator that models caffeine extraction based on preparation method, water temperature, steeping time, and number of refills.

The Problem: Mate Caffeine Varies 3x

I analyzed published research on yerba mate caffeine content and found enormous variation:

Preparation Caffeine per serving
Mate cocido (tea bag) 20-40mg
French press 60-90mg
Traditional calabaza (1st pour) 65-130mg
Traditional calabaza (full session, 10+ refills) 200-400mg
Tereré (cold water) 15-35mg

The 3x+ variation means a blanket "85mg" number is misleading. A mate session can deliver more caffeine than two espressos — or less than a green tea, depending on how you prepare it.

How It Works

The calculator uses three key variables:

1. Extraction curve modeling

Caffeine doesn't extract linearly. The first pour extracts ~40% of available caffeine, with exponential decay on subsequent refills. I modeled this as:

caffeine(n) = C_total × 0.4 × (0.7)^(n-1)
Enter fullscreen mode Exit fullscreen mode

Where n is the refill number and C_total is the total extractable caffeine in the yerba (varies by brand, cut, and age).

2. Temperature factor

Hot water (70-80°C, traditional mate) extracts caffeine faster than cold water (tereré). The temperature coefficient:

temp_factor = 0.3 + 0.7 × (temp / 80)
Enter fullscreen mode Exit fullscreen mode

This means tereré at 5°C extracts roughly 34% as much caffeine per pour as hot mate.

3. Yerba-to-water ratio

Traditional mate uses a 2:3 yerba-to-water ratio in the gourd — far more concentrated than any other tea preparation. This matters because higher concentration = faster extraction.

Technical Implementation

The calculator is a single HTML file with zero dependencies — no frameworks, no build step, no tracking:

  • Vanilla JavaScript for calculations
  • CSS Grid for responsive layout
  • localStorage for saving preferences
  • Under 15KB total (loads in <100ms on 3G)

Input fields: preparation method, yerba amount (g), water temperature, number of refills, session duration.

Output: total caffeine estimate, per-refill breakdown chart, comparison to coffee/tea, and a safety note about daily limits.

What I Learned

1. Research papers disagree wildly. Caffeine content for the same preparation method can vary 2x between studies. I ended up averaging 12 papers and weighting by sample size.

2. Nobody else does this. I searched for existing mate caffeine calculators and found zero that account for preparation method. Every result on Google just gives a flat "85mg per cup" number. This is a genuine content gap.

3. Single-file tools are underrated. No npm, no webpack, no React. The entire calculator is one .html file that works offline. Deployment is literally copying a file.

Try It

The calculator is live at botanicaandina.com/herramientas/calculadora-mate/ (Spanish) as part of our free health tools collection.

If you're interested in herb-drug interactions, we also built a supplement interaction checker that covers 250+ plants and 500+ medications — also a single-file tool, no server required.

The code is structured so you could adapt the extraction model for any caffeinated plant — coffee, guayusa, guaraná, or even cacao. The math is the same; only the constants change.


Building health tools in LATAM. If you're working on similar projects, I'd love to hear about your approach to modeling bioactive compound extraction.

Top comments (0)