Solar declination approximation calculator
On day 172, near the northern summer solstice, the Sun's declination comes out at 23.45°, the highest point of this cosine model; winter days give negative values of similar size. Only the day number is needed. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Day
- 172
- Declination deg
- 23.45
- Axial tilt deg
- 23.45
Solar declination is the angular distance of the Sun north or south of the celestial equator—the quantity that drives seasonal day length, solar altitude at noon, and simple irradiance models used in architecture, HVAC, and introductory trigonometry and astronomy. Given only the day of the year as an integer from one through three hundred sixty-six, the cosine model of Earth axial tilt returns an approximate declination in degrees without ephemerides, leap-second tables, or network calls: δ equals 23.45 degrees times the cosine of two pi over three hundred sixty-five times day minus one hundred seventy-two. Day one hundred seventy-two sits near the northern summer solstice so the cosine peaks near plus twenty-three point four five degrees; winter days produce negative values of similar magnitude.
What solar declination tells you
Solar declination is the angle of the Sun north or south of the celestial equator. It equals the latitude of the place on Earth where the Sun stands directly overhead at noon: positive when that place is north of the equator, negative when it is south. Over the year it swings back and forth by roughly the tilt of Earth's axis, and that swing shapes the length of the day, the height of the noon Sun and the sunlight used in simple models for buildings, heating, cooling and classroom astronomy.
How the estimate works and where it falls short
The model needs only the day of the year. It multiplies 23.45 degrees by the cosine of a full turn spread over 365 days, counted from day 172, so the curve peaks around 21 June and reaches its lowest values in the northern winter. That is enough for a rough noon-altitude or shading sketch. It is not an almanac: precise work follows the true position of the Sun with extra corrections. A common slip is typing a calendar date instead of the day number.
What you can do with it
Solar design and HVAC sketches
Architects and energy modelers need a quick seasonal δ for rough noon-altitude or shading estimates without wiring an ephemeris stack into early design scripts.
FAQ
What happens if the day is outside 1–366?
Day of year must be an integer between 1 and 366 inclusive; values such as 0 or 367 are rejected and are not charged.
Is this a high-precision astronomical ephemeris?
No. It is a fixed-obliquity cosine approximation of Earth axial tilt for classroom and engineering use. It does not include nutation, equation of center, or true solar longitude.
What is the solar declination on day 172?
About 23.45 degrees, the highest value in this model. Day 172 corresponds to around 21 June in a non-leap year, close to the northern summer solstice, when the Sun stands farthest north of the equator.
What does a negative solar declination mean?
It means the Sun stands south of the celestial equator. In this model, days of the northern winter give negative values of a size similar to the summer peak of 23.45 degrees.
How do I find the day number of a date?
Count from 1 January, which is day 1. Day 172 falls around 21 June in a non-leap year, and the count can reach 366 when the year has a leap day.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/trig/declination-approx \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"day":172}'const res = await fetch("https://api.kit.forhosting.com/trig/declination-approx", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"day": 172
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/trig/declination-approx",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"day": 172
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/trig/declination-approx", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"day":172}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"day":172}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/trig/declination-approx", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"day": 172
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "trig.declination_approx",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
This capability evaluates that expression deterministically, rejects days outside one to three hundred sixty-six with a clear invalid input error, and returns structured JSON that homework checkers, solar-design spreadsheets, and lightweight pipelines can pin in continuous integration.
What solar declination means and which day value to send
Declination of the Sun is the latitude of the subsolar point: positive when the Sun stands north of the equator, negative when south. Over a tropical year it swings between roughly plus and minus the obliquity of the ecliptic, about twenty-three and a half degrees. Full reductions use the true longitude of the Sun, equation of center, and nutation, but engineering and classroom practice often need only a smooth seasonal curve grounded in elementary trigonometry. The cosine axial-tilt model fixes the obliquity at twenty-three point four five degrees and places the peak at day one hundred seventy-two, approximating twenty-one June in a non-leap calendar. Send the required field day as a JSON number or numeric string representing the ordinal day of year: one for the first of January, thirty-two for the first of February in a non-leap year, one hundred seventy-two near the summer solstice, three hundred fifty-five near the winter solstice, and up to three hundred sixty-six when a leap day is present. Aliases day_of_year, doy, n, and N are accepted for the same integer. Non-integers, non-finite values, and days outside one through three hundred sixty-six fail with invalid_input because they are not a valid day-of-year index for this model. Identical inputs always produce identical JSON because the path is pure floating-point arithmetic with no network, no random seed, and no wall clock. That reproducibility is essential when tutors pin goldens, when design scripts re-run seasonal batches, and when coding assessments must grade the same number every time.
Reading the response fields and checking classic calendar markers
Near day one hundred seventy-two you should see a value very close to plus twenty-three point four five degrees; near day three hundred fifty-five the cosine is near negative one and declination is near minus twenty-three point four five degrees; around day eighty-one and day two hundred sixty-four the model crosses near zero at the equinoxes. On success the response echoes day, then reports declination_deg as the approximate solar declination in degrees under the cosine axial-tilt model. The field axial_tilt_deg is always twenty-three point four five, the fixed Earth obliquity used by the formula. The formula field is always the string δ equals 23.45 times cos of 2π over 365 times open parenthesis N minus 172 close parenthesis, and method is always cosine_axial_tilt so downstream code can branch without sniffing shapes. Missing day, non-integer day, day zero, day three hundred sixty-seven, and non-finite numbers all fail with invalid_input and are not charged after the engine rejects the request. Use declination_deg alone when a dashboard only needs the angle; keep formula, method, and axial_tilt_deg when documenting the trigonometry step for students or logging which approximation produced a solar-gain sketch. Pair this endpoint with solar altitude or day-length tools when the next question is how high the Sun stands at local noon for a given latitude—remembering that declination is only one input to those formulas and that latitude and hour angle complete the altitude identity.
API usage, pricing, design workflows, and practical limits
Call the free in-browser solar declination approximation calculator for homework checks, lecture demos, and quick solar-design verification without installing SPICE, NOVAS, or a full ephemeris library. Typical examples include midsummer day one hundred seventy-two for maximum northern declination, midwinter day three hundred fifty-five for the southern extreme, and equinox-neighborhood days for near-zero declination. The model uses three hundred sixty-five in the cosine argument even when day equals three hundred sixty-six—that is the standard textbook simplification and is intentional. Send a JSON body with required integer day between one and three hundred sixty-six inclusive. Use the prepaid API when a tutoring platform, coding-assessment sandbox, curriculum generator, or building-energy pipeline needs a stable contract under KIT balance at $0.002 per successful item; validation failures never consume balance after rejection. Authors shipping SDKs can map declination_deg into tables of seasonal noon altitude or clear-sky irradiance estimates, teaching how a single smooth cosine of axial tilt captures the dominant annual signal before students graduate to higher-order astronomical reductions. Keep requests small, document the formula field next to charts, and treat invalid_input as a client-side range check rather than a retryable server fault.
Integration use cases
Homework and exam verification
Students and graders compute approximate solar declination from a day of year, compare against textbook solstice and equinox markers, and get a clear invalid_input error when the day falls outside 1–366.
Tutoring and curriculum generators
Lesson builders produce worked cosine axial-tilt examples with structured JSON for flashcards, step sheets, and auto-graded drills that teach seasonal trigonometry before full orbital mechanics.
Technical questions
How do I approximate solar declination from the day of the year?
Send JSON with day set to an integer from 1 to 366 (for example 172 near the northern summer solstice). The response includes declination_deg from δ=23.45·cos(2π/365·(N−172)).
What does axial_tilt_deg mean in the response?
It is the constant obliquity used by the model, always 23.45 degrees. Declination swings between roughly plus and minus that value over the year under this approximation.
How much does the API cost?
Successful calls cost $0.002 per item. The browser widget is free on your device. Validation failures that raise invalid_input do not consume balance.