Matter density at redshift calculator
The matter density at redshift calculator scales a present-day matter density by the cube of one plus redshift.
Run — free
Enter the current density in kilograms per cubic metre and a redshift of at least -1 to obtain rho(z), the multiplier, and the intermediate value 1 + z. The calculation is deterministic and follows the standard volume-scaling relation for non-relativistic matter. It is useful for quick cosmology checks, classroom exercises, model inputs, and reproducible API workflows without needing a spreadsheet or a full cosmology package.
What the redshift scaling means
In an expanding cosmological model, conserved non-relativistic matter becomes less dense as physical volume grows. Linear dimensions scale with the cosmological scale factor, while volume scales with its cube. Redshift is related to scale factor through a = 1/(1 + z), so matter density relative to its present value grows as (1 + z)^3 when looking back to positive redshift. This calculator applies that relationship directly: rho(z) = rho0(1 + z)^3. A redshift of zero returns the present density unchanged. A redshift of one gives a multiplier of eight, because two cubed is eight. A redshift of two gives a multiplier of twenty-seven. The result is expressed in kilograms per cubic metre because the required present density uses that unit. This relation describes matter dilution only; it does not calculate radiation density, dark-energy density, critical density, or the total expansion history. Those components follow different redshift behavior and should not be substituted for the matter density input without a model-specific reason.
How to enter values and read the result
Provide present_density_kg_m3 as a finite, non-negative number in kilograms per cubic metre and redshift as a finite number greater than or equal to -1. Scientific notation is appropriate for cosmological densities, so a value such as 2.7e-27 can be entered without expanding all of its zeros. The output repeats both inputs, reports one_plus_redshift, reports the dimensionless scaling_factor, and returns matter_density_kg_m3 as the primary result. It also includes the unit and formula so stored results remain understandable outside the calculator. For example, with a present density of 2.7e-27 kg/m^3 and z = 2, one plus redshift is 3 and the scaling factor is 27. Multiplying the present density by 27 produces the density at that redshift. Floating-point output follows JavaScript number precision, which is suitable for ordinary scientific calculations but should not be treated as arbitrary-precision decimal arithmetic. Keep consistent SI units when comparing the result with another quantity or passing it into a later calculation.
Domain limits and scientific interpretation
The calculator rejects redshift below -1. At z = -1, one plus redshift is zero and this mathematical scaling returns zero density. Values below -1 would make 1 + z negative and fall outside the physical redshift domain used by this relation, so they are reported as invalid input rather than producing a misleading negative density. Negative present-day density is also rejected because ordinary matter density is non-negative. The formula assumes the matter component scales exactly with inverse physical volume and that the supplied rho0 is the present value of the same component. It does not infer rho0 from a density parameter, the Hubble constant, or a critical-density model. It also does not include matter creation, decay, interactions, or relativistic transitions. For precision cosmology, use parameters and conventions from the relevant dataset and propagate their uncertainties separately. This tool is strongest as a transparent unit-preserving calculation: it exposes the multiplier, makes boundary behavior explicit, and produces the same answer for the same inputs in the browser or through the API.
What you can do with it
Prepare a cosmology model input
Scale a documented present-day matter density to the redshift required by a simulation, notebook, or analytic estimate.
Check coursework calculations
Verify the cubic redshift multiplier and resulting SI density without manually expanding scientific notation.
Build a reproducible data pipeline
Calculate density from structured inputs through the API and retain the formula, multiplier, and unit beside the result.
FAQ
What formula does the calculator use?
It uses rho(z) = rho0(1 + z)^3, where rho0 is the present-day matter density and z is redshift.
What units does the result use?
The result is returned in kilograms per cubic metre (kg/m^3), matching the required unit of the present-density input.
Why is a redshift below -1 rejected?
The physical redshift domain for this scaling has 1 + z greater than or equal to zero. A value below -1 would make that factor negative and is therefore invalid.
Does this include radiation or dark energy?
No. It scales only the supplied matter density. Radiation and dark energy have different redshift behavior and require separate calculations.
How much does an API calculation cost?
Each API request costs $0.002. The same deterministic calculation can also run in the browser.
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/astro/matter-density-at-z \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"present_density_kg_m3":2.7e-27,"redshift":2}'const res = await fetch("https://api.kit.forhosting.com/astro/matter-density-at-z", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"present_density_kg_m3": 2.7e-27,
"redshift": 2
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/astro/matter-density-at-z",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"present_density_kg_m3": 2.7e-27,
"redshift": 2
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/astro/matter-density-at-z", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"present_density_kg_m3":2.7e-27,"redshift":2}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"present_density_kg_m3":2.7e-27,"redshift":2}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/astro/matter-density-at-z", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"present_density_kg_m3": 2.7e-27,
"redshift": 2
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "astro.matter_density_at_z",
"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. |