# Sunrise Sunset Calculator

Calculate sunrise and sunset times for any location and date. Enter latitude, longitude, and day of year to find daylight duration and solar noon.

## What this calculates

Find out when the sun rises and sets at any location on any day of the year. Enter your latitude, longitude, and the day of the year, and this calculator uses solar position equations to compute sunrise, sunset, solar noon, and total daylight hours. New York City on the summer solstice (day 172) gets about 15 hours of daylight, while Fairbanks, Alaska gets over 21 hours.

## Inputs

- **Latitude** (°) — min -90, max 90 — Latitude in decimal degrees. Positive = North, negative = South.
- **Longitude** (°) — min -180, max 180 — Longitude in decimal degrees. Positive = East, negative = West.
- **Day of Year** — min 1, max 366 — Day number (1-365). Jan 1 = 1, Jun 21 = 172, Dec 21 = 355.
- **UTC Offset** (hr) — min -12, max 14 — Time zone offset from UTC (e.g., -5 for EST, -8 for PST, 0 for GMT).

## Outputs

- **Sunrise** — formatted as text — Sunrise time in local time.
- **Sunset** — formatted as text — Sunset time in local time.
- **Solar Noon** — formatted as text — Time when the sun is highest in the sky.
- **Daylight Duration** — formatted as text — Total hours and minutes of daylight.
- **Solar Declination** (°) — Angle of the sun relative to the equatorial plane.

## Details

**How it works:**

The calculator uses the Spencer (1971) equations for solar declination and the equation of time to determine the sun's position relative to any point on Earth.

**Key formulas:**
- **Solar declination:** The angle between the sun and the equatorial plane, ranging from +23.45° (summer solstice) to -23.45° (winter solstice)
- **Hour angle:** cos(HA) = -tan(lat) x tan(declination). This determines how many degrees the Earth rotates between sunrise and solar noon.
- **Solar noon:** 12:00 - 4 x longitude - equation of time (adjusted for time zone)

**Day of year reference:**
- January 1 = Day 1
- March 20 (spring equinox) = Day 79
- June 21 (summer solstice) = Day 172
- September 22 (fall equinox) = Day 265
- December 21 (winter solstice) = Day 355

**Polar regions:**

At latitudes above the Arctic Circle (66.5°N) or below the Antarctic Circle (66.5°S), the sun can stay above or below the horizon for entire days. The calculator detects midnight sun and polar night conditions and reports them instead of times.

**Accuracy note:**

These times are within about 1-2 minutes of official NOAA values. Differences come from atmospheric refraction (which makes the sun visible slightly before geometric sunrise) and the fact that official sunrise/sunset times use the upper limb of the sun's disk, not its center.

## Frequently Asked Questions

**Q: How do I find my latitude and longitude?**

A: The easiest way is to search your city on Google Maps and read the coordinates from the URL. For example, New York City is 40.7128, -74.0060. Most weather apps also show your coordinates. Remember: positive latitude is North, positive longitude is East.

**Q: What is the day of year for a specific date?**

A: January 1 is day 1, February 1 is day 32, March 1 is day 60 (or 61 in a leap year). A quick way: count the days from January 1. June 21 (summer solstice) is day 172, and December 21 (winter solstice) is day 355.

**Q: Why are the times slightly different from official sources?**

A: Official sunrise/sunset times (like from NOAA) account for atmospheric refraction, which bends sunlight around the horizon and makes the sun visible about 2 minutes before it geometrically clears the horizon. They also use the upper edge of the sun, not its center.

**Q: What causes different day lengths throughout the year?**

A: Earth's axis is tilted 23.45 degrees relative to its orbital plane. During summer, your hemisphere tilts toward the sun, giving longer days. At the equator, day length barely changes throughout the year. Near the poles, the variation is extreme, from 24-hour daylight in summer to 24-hour darkness in winter.

---

Source: https://vastcalc.com/calculators/physics/sunrise-sunset
Category: Physics
Last updated: 2026-04-08
