ForHosting KIT · Science

Specific gravity calculator

Aluminum at 2.7 g/cm³ against water at 1 g/cm³ has a specific gravity of 2.7, so it is denser than water. Enter two densities in the same unit, with the reference you choose, to get the ratio and the comparison. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Density
2.7
Reference density
1
You get
Specific gravity
2.7
Relative density
2.7
Comparison
greater

Specific gravity is the dimensionless ratio of a substance density to a chosen reference density, most often liquid water at a stated temperature. Materials engineers, chemists, hydrologists, and students use it to say how dense a sample is without carrying units: a specific gravity of 2.7 means the sample is two point seven times as dense as the reference. This specific gravity calculator applies the identity SG equals density divided by reference density and returns that ratio together with the echoed inputs. Both values must share the same density unit so the units cancel in the quotient.

What specific gravity means and how the ratio is computed

Specific gravity, also called relative density, is the ratio of the mass density of a sample to the mass density of a reference substance expressed in the same unit. Write ρ for the sample density and ρ_ref for the reference; then SG equals ρ divided by ρ_ref. The result is dimensionless because the two density units cancel.

When the reference is liquid water near four degrees Celsius, a specific gravity of one means the sample has the same density as water, a value greater than one means it is denser than water and will sink in it if insoluble, and a value less than one means it is less dense and will float.

Aluminum at about 2.7 grams per cubic centimetre against water at 1.0 grams per cubic centimetre yields 2.7; ethanol at 0.789 grams per cubic centimetre yields 0.789; a steel of 8000 kilograms per cubic metre against water at 1000 kilograms per cubic metre yields 8. The identity is the same whether you work in SI, cgs, or customary density units, provided both arguments use that same scale. This calculator does not convert units and does not assume water: you choose the reference.

Petroleum labs often compare oils to water at sixty degrees Fahrenheit; mineralogists compare crystals to water at four degrees Celsius; balloonists compare a lifting gas to dry air. Zero sample density is allowed and yields specific gravity zero. Zero reference density is not allowed, because division by zero is undefined.

Who uses specific gravity, and in which units

Teaching labs, mineralogy benches, hydrometers, and process quality teams use a specific gravity calculator whenever two densities are already known and the notebook still needs the dimensionless ratio. Students check that a metal denser than water has SG greater than one without mixing SI and cgs by hand. Assay and foundry teams convert paired density readings into SG so they can compare an alloy, a slurry, or a polymer against a specification written as specific gravity, not as kilograms per cubic metre.

Tutoring platforms and exam generators need a deterministic oracle that rejects a zero reference instead of silently returning Infinity. Failed validation does not consume balance. Keep both densities in one unit before you call.

Do not send a mass and a volume as if they were densities. Keep requests small, pin the rounded specific gravity in tests, and you get a reproducible dimensionless ratio for homework, laboratory QC, and edge workers without standing up a computer-algebra system of your own.

Materials and mineral identification

Enter a measured crystal or alloy density and water as the reference to obtain specific gravity for comparison against mineral tables and alloy specifications.

Petroleum, slurry, and chemical QC

Convert paired density readings into a dimensionless SG so a specification written as specific gravity can be checked without a spreadsheet quotient.

Homework and LMS auto-grading

Mark specific-gravity items with a deterministic oracle that rejects a zero reference density and never invents Infinity for an undefined ratio.

How do I calculate specific gravity from two densities?

Send a finite sample density ρ and a non-zero reference density ρ_ref in the same unit. Specific gravity is SG = ρ / ρ_ref.

What happens if the reference density is zero?

Specific gravity is a quotient, so a zero reference density is undefined and is not billed.

Do density and reference density need the same units?

Yes. Units cancel in the ratio, so any coherent pair (kg/m³ with kg/m³, g/cm³ with g/cm³) is valid. The calculator does not convert density units.

Is specific gravity the same as relative density?

Yes. Relative density is the ISO name for the same dimensionless ratio ρ / ρ_ref.

What does a specific gravity above or below 1 mean?

Above 1 the sample is denser than the reference, below 1 it is lighter, and exactly 1 means the same density. Against water, an insoluble sample above 1 sinks and one below 1 floats; the result also says greater, less or equal.

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.

POSThttps://api.kit.forhosting.com/phys/specific-gravity

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.

curl -X POST https://api.kit.forhosting.com/phys/specific-gravity \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"density":2.7,"reference_density":1}'
{
  "density": 2.7,
  "reference_density": 1
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "phys.specific_gravity",
  "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.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

If the reference density is zero the ratio is undefined and the task fails with invalid_input rather than returning Infinity.

What specific gravity means and how the ratio is computed

Identical numeric inputs always produce identical JSON because the path is pure floating-point arithmetic with no network, no language model, no random seed, and no wall clock.

Input contract, response shape, and zero-reference validation

A zero sample density is accepted and returns specific gravity zero. Extremely large magnitudes that would overflow to Infinity are rejected. POST a JSON body with two required finite numbers: density, the mass density of the substance, and reference_density, the mass density of the standard you are comparing against. Each field may arrive as a JSON number or as a numeric string; missing fields, empty strings, and non-finite values fail with invalid_input naming the field and are not billed. Aliases are accepted so existing lab or instrument payloads map without renaming: rho, substance_density, sample_density, and d for density; rho_ref, ref_density, reference, and water_density for reference_density. On success the body echoes density and reference_density, then specific_gravity and relative_density as the same rounded ratio, a comparison of greater, less, or equal against a ratio of one, plus a formula string restating SG equals ρ over ρ_ref and method equal to specific_gravity_ratio so clients can branch without sniffing shapes. Pair the response with your own unit labels if you need a printed certificate; this endpoint returns the numbers, not a formatted report. Example: density 2.7 and reference_density 1 is the classic aluminum-versus-water pair, so specific gravity is exactly 2.7 and comparison is greater.

Where a specific gravity API earns its keep, units, and price

This capability stops at the density ratio; it does not convert petroleum degrees API, it does not compute density from mass and volume, and it does not apply buoyancy force.

What does the specific gravity calculator cost?

The browser tool is free. API requests use prepaid balance at $0.002 per successful call; invalid input is not billed.

Read the full KIT documentation →