🌍 Carbon FootprintCalculator

Estimate your annual carbon emissions, compare globally, and get personalized reduction tips

📊 inputYour Lifestyle

🚗 Transportation

🏠 Home Energy

🍖 Diet

${i.name}
`).join(''); // Pie const svg=document.getElementById('pieChart');svg.innerHTML=''; let start=0; items.forEach(i=>{ const pct=i.v/total*100,angle=pct/100*360; const large=angle>180?1:0; const end=start+angle; const x1=120+95*Math.cos(start*Math.PI/180),y1=120+95*Math.sin(start*Math.PI/180); const x2=120+95*Math.cos(end*Math.PI/180),y2=120+95*Math.sin(end*Math.PI/180); if(pct>0)svg.innerHTML+=``; if(pct>5){const mid=start+angle/2;const tx=120+60*Math.cos(mid*Math.PI/180),ty=120+60*Math.sin(mid*Math.PI/180);svg.innerHTML+=`${i.name} ${pct.toFixed(0)}%`} start=end; }); // Tips const tips=[]; if(transport>2)tips.push('🚗 Transport is the biggest emitter, Try public transit or carpooling, drive 2 fewer days per weekcan reduce ~0.5 tonnes'); if(transport>1&&carKm>5000)tips.push('🚲 Switch to cycling or walking for short commutes — reduces emissions and improves health'); if(flights>=4)tips.push('✈️ Flying is high-carbon — prefer high-speed rail for short-haul flights'); if(energy>2)tips.push('💡 Save electricity: use LED bulbs, raise AC by 1°C, turn off lights — saves ~0.3 tonnes/year'); if(diet==='heavy')tips.push('🥬 Reduce red meat once per week, switch to chicken or beans, /year reduce ~0.3 tonnes'); if(diet!=='veg'&&diet!=='vegan')tips.push('🌱 Try one vegetarian day per week, Carbon Footprintsignificantly lower'); if(shopping>0.5)tips.push('📦 Reduce impulse spending, choose local productsreduce transport emissions'); if(clothes>500)tips.push('👕 Fast fashion has a huge carbon footprint — choose durable or second-hand clothing'); if(tips.length===0)tips.push('🎉 Your Carbon Emissionvery low, keep up your low-carbon lifestyle!'); document.getElementById('tips').innerHTML=tips.map(t=>`
  • ${t}
  • `).join(''); document.getElementById('results').style.display='block'; } calc();