TL;DR
wttr.in is the internet's most curl-friendly weather service. Get current conditions, forecasts, and astronomy data for any location worldwide. Output in multiple formats: JSON (?format=j1), plain text (great for terminals), PNG images (for embedding), and ANSI-colored text (for terminal use). Accessible via browser, curl, or any HTTP client. No API key required.
Quick start: https://wttr.in/London?format=j1
No API key needed — free weather for any location!
How to Use This API
1. Get Weather as JSON
Returns full weather data for any city in JSON format:
https://wttr.in/London?format=j1
2. Get Weather in Terminal (Plain Text)
curl wttr.in/Tokyo
3. Weather by GPS Coordinates
https://wttr.in/48.85,2.35?format=j1
4. JavaScript — Display Temperature
fetch('https://wttr.in/Paris?format=j1')
.then(r => r.json())
.then(data => {
const current = data.current_condition[0];
console.log(`Paris: ${current.temp_C}°C, ${current.weatherDesc[0].value}`);
console.log(`Humidity: ${current.humidity}%, Wind: ${current.windspeedKmph} km/h`);
console.log(`Feels like: ${current.FeelsLikeC}°C`);
});
5. Python — 3-Day Forecast
import requests
city = 'New York'
data = requests.get(f'https://wttr.in/{city}?format=j1').json()
for day in data['weather']:
date = day['date']
avg_temp = (int(day['maxtempC']) + int(day['mintempC'])) / 2
desc = day['hourly'][0]['weatherDesc'][0]['value']
print(f"{date}: {avg_temp:.0f}°C, {desc}")
# Also available: astronomy data (sunrise, sunset, moon phase)
astro = data['weather'][0]['astronomy'][0]
print(f"\nSunrise: {astro['sunrise']}, Sunset: {astro['sunset']}")
6. Simple One-Line Output Format
https://wttr.in/Mumbai?format=%t+%c+%w
London JSON:
https://wttr.in/London?format=j1
Frequently Asked Questions
- What output formats are available?
?format=j1— JSON,?format=3— 3-line terminal view,?format=png— PNG image,?format=%c+%t— custom format strings. Default is the full terminal view with ANSI colors and Unicode art.- How do I get weather for disambiguated locations?
- Use
?0suffix or continent/country prefix:~London,UK,~London,Ohio. Use IATA airport codes for major airports:JFK,LAX,LHR. - What data does the JSON response include?
- Current conditions (temp, feels like, humidity, wind speed/direction, pressure, visibility, UV index), 3-day forecast (hourly breakdown), astronomy (sunrise, sunset, moon phase), and location info (timezone, coordinates).
- Can I embed the weather as an image?
- Yes —
https://wttr.in/London.pngreturns a PNG image. Use?mfor metric or?ufor imperial units. Configure colors and size with additional parameters. - Is there a rate limit?
- wttr.in is free for reasonable usage. It's widely used in terminals and scripts. For high-volume production use, consider caching responses or self-hosting.
- What custom format strings are available?
- Use
?format=%t+%c+%w+%h+%pfor temperature, condition symbol, wind, humidity, and precipitation. Full list:%c(condition),%t(temp),%w(wind),%h(humidity),%p(precipitation),%l(location).
API Details
- API URL
https://wttr.in/{location}- Documentation
- wttr.in
- Category
- Weather
- Authentication
- Not Required
- Output Formats
- JSON, plain text, PNG, ANSI
What You Can Build
- Terminal weather widget for your shell prompt or tmux status bar
- Weather dashboard showing conditions for multiple cities
- Embedded weather image for blogs, READMEs, or dashboards
- Travel planning app comparing weather across destinations
- CI/CD pipeline weather check before outdoor deployment activities