ForHosting KIT · Math

Square diagonal calculator

Multiply the side of a square by √2 and get its corner-to-corner diagonal: a side of 5 gives 7.071067811865 and a side of 1 gives 1.414213562373. A zero side gives zero, negative sides are rejected. 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
Side
5
You get
Diagonal
7.0710678119

A square has four equal sides and four right angles, so each diagonal is the hypotenuse of a right isosceles triangle whose legs are the side length. That geometry gives the closed formula d = s√2: multiply the side by the square root of two and you have the full corner-to-corner distance without constructing the figure. This square diagonal calculator accepts a single non-negative side length, validates that the number is finite, and returns the diagonal with a stable formula tag. No network calls, no random sampling, and no Date.

How the square diagonal is computed from the side length

Place a square of side s in the coordinate plane with one corner at the origin and adjacent sides along the positive axes. The opposite corner then sits at the point (s, s). The Euclidean distance from (0, 0) to (s, s) is the square root of s squared plus s squared, which simplifies to the square root of two s squared, or s times the square root of two.

That is exactly the Pythagorean theorem applied to the right triangle formed by two sides and the diagonal: the legs are equal, the hypotenuse is the diagonal, and the 45-45-90 special-triangle ratio says the hypotenuse is the leg times √2. The calculator implements that identity with a single multiply by Math.SQRT2 after parsing and validating the side. Zero side length is allowed and returns a zero diagonal, matching a degenerate square collapsed to a point.

Negative side lengths are rejected because length is not signed in Euclidean geometry for this purpose; Infinity and NaN are rejected as non-finite. Classic checks include side one yielding √2 approximately 1.414213562373, side five yielding five times √2, and side zero yielding zero. Because the path uses only arithmetic and a constant square root, it is deterministic, O(1), and free of iterative solvers or unit conversions.

What you send and what you get back

Provide one required finite non-negative number: side, the length of any edge of the square. Numeric fields are rounded to twelve decimal places for stable goldens across runtimes. Example checks: side five returns diagonal approximately 7.071067811865; side one returns approximately 1.414213562373; side zero returns zero; side negative three fails naming the non-negative constraint.

Wire the free browser tool for quick sanity checks on homework or cut lists, then call the identical contract from scripts for bulk evaluation without reimplementing the √2 multiply in every language.

Where square diagonal lengths show up in real work

Secondary-school and college geometry courses constantly ask for the diagonal of a square once the side is known; a trusted calculator with a strict non-negative gate speeds homework grading and removes spreadsheet mistakes where someone multiplies by two instead of √2 or confuses face diagonal with space diagonal of a cube. Carpentry, tiling, and framing workflows use the diagonal as a square-check: if both diagonals of a four-sided frame equal s√2 for the intended side, the corners are square.

Architecture and product design teams size square panels, screens, and plates; the diagonal feeds packing, clearance, and shipping constraints when only the side is specified. Game, graphics, and CAD libraries store square quads for tiles, UI panels, and UV shells; deterministic diagonals support collision proxies and layout math without a full computational-geometry stack.

If you later need cube face or space diagonals, rhombus diagonals from sides and angles, or the count of diagonals in an n-gon, treat those as separate search intents rather than overloading this square-diagonal landing—the cube path lives under the cube calculator, rhombus under the rhombus calculator, and n-gon diagonal counting is a different combinatorial problem.

Framing and square-checks

From a known side, recover the expected diagonal so carpenters and fabricators can verify corners are square.

What formula is used?

diagonal = side × √2, from the Pythagorean theorem on two equal sides (or the 45-45-90 triangle ratio).

Is a side of zero allowed?

Yes. Zero is a non-negative length and returns diagonal zero (a degenerate square at a point). Only negative sides fail.

Is this the same as a cube diagonal?

No. This tool returns the face diagonal of a square (s√2). A cube also has a space diagonal (s√3); use a cube calculator for that.

What does it cost?

The browser tool is free and runs locally.

Why is the diagonal of a square the side times √2?

The diagonal splits the square into two right triangles with equal legs. By Pythagoras, the diagonal is the square root of the side squared plus the side squared, which is the side times √2.

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/geom/square-diagonal

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/geom/square-diagonal \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"side":5}'
{
  "side": 5
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "geom.square_diagonal",
  "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.

Students checking homework, carpenters laying square frames, CAD and fabrication teams sizing panels, and automated graders that must fail negative dimensions all get the same pure result in the free browser tool and the paid API. Negative sides fail with invalid_input instead of inventing a length.

What you send and what you get back

Missing fields, empty strings, non-numeric text, NaN, Infinity, and any negative side are rejected with invalid_input and are not charged. On success the JSON response echoes side, returns diagonal as side times √2, sets formula to the string d = s√2, and sets method to square_diagonal so logs and teaching UIs can document the algorithm without re-deriving Pythagoras. API pricing is the published base of $0.002 per successful item; invalid input does not consume balance.

Where square diagonal lengths show up in real work

Because this capability is a pure parse engine, failed validation does not consume balance and successful runs stay at $0.002 per item.

Homework and exam checks

Compute the square diagonal from side length with d = s√2, and reject negative sides with a clear invalid_input error.

CAD and game square tiles

Turn one side length into the corner-to-corner diagonal for layout, packing, and self-describing geometry fixtures in browser or API.

What input does the square diagonal calculator need?

One finite non-negative number: side (aliases s, a, length, side_length, edge). Negative values and non-finite numbers are rejected.

Read the full KIT documentation →