CSS sin(), cos(), tan() Demo - Online Animated Trig
Use trigonometric functions in CSS to create circular animations and layouts without JavaScript. See the code.
UD5 Toolkit
Interactive playground for CSS mathematical functions — explore powers, square roots, hypotenuse calculations & their trigonometric connections
Returns baseexponent. Ideal for fluid type scales, exponential spacing, and dynamic sizing systems.
Returns the square root. Perfect for calculating diagonal lengths, normalizing values, and area-to-side conversions.
Returns √(a² + b² + …). The Pythagorean theorem in CSS — crucial for distance, shadow offsets, and trigonometric layouts.
:root {
--base: 2;
--exponent: 3;
}
.box {
width: calc(pow(var(--base), var(--exponent)) * 15px);
height: calc(pow(var(--base), var(--exponent)) * 15px);
/* = 8 × 15px = 120px */
}
:root {
--area: 64;
}
.side {
width: calc(sqrt(var(--area)) * 10px);
height: calc(sqrt(var(--area)) * 10px);
/* = 8 × 10px = 80px */
}
:root {
--offset-x: 30;
--offset-y: 40;
}
.shadow-distance {
--dist: hypot(var(--offset-x), var(--offset-y));
box-shadow: 0 0 calc(var(--dist) * 1px) rgba(0,0,0,0.25);
/* = 50px blur radius */
}
/* Also useful for: */
.diagonal-length {
width: calc(hypot(300, 400) * 1px); /* = 500px */
}
pow(base, exponent) calculates base raised to the exponent power. sqrt(value) returns the square root. hypot(a, b, …) computes the square root of the sum of squares — essentially the Pythagorean hypotenuse. They return numeric values usable anywhere CSS accepts numbers (calc(), custom properties, etc.).sin(), cos(), and tan() handle angular trigonometry, hypot() directly implements the Pythagorean theorem (c² = a² + b²), which is foundational to trigonometry. Together, they enable complex geometric calculations in pure CSS — for example, hypot() gives you the hypotenuse, while atan2(y, x) gives you the angle. They complement each other for positioning, rotation, and distance calculations.@supports queries or pre-calculate values with a CSS preprocessor. Always test with @supports (width: calc(pow(2, 3) * 1px)) before relying on these functions.pow(1.25, var(--step))), exponential spacing systems, dynamic animation curves, and non-linear size relationships. For example, you can create a type scale where each heading is 1.25× the previous: font-size: calc(pow(1.25, var(--level)) * 1rem).sqrt() when you need to normalize values, calculate diagonal lengths of elements (width² + height² under a square root), convert area to side length, or implement inverse-square law effects (like realistic lighting/shadows where intensity falls with distance²). It's also handy for creating circular progress indicators and radial layouts.hypot() is more concise than sqrt(pow(a, 2) + pow(b, 2)), less error-prone, and more readable. It also handles edge cases better — it's numerically stable for very large or very small values, avoiding overflow/underflow that can occur when squaring numbers manually. Plus, it accepts multiple arguments: hypot(3, 4, 5) computes √(3²+4²+5²) = √50 ≈ 7.07.pow(): The base must be non-negative (≥ 0), though the exponent can be any real number. sqrt(): The input must be non-negative (≥ 0); negative values are invalid. hypot(): Arguments can be any real numbers (positive, negative, or zero) — the result is always non-negative since it's the square root of a sum of squares. Always validate inputs when using CSS custom properties with these functions.@supports feature queries:@supports (width: calc(hypot(3, 4) * 1px)) { /* modern code */ }--distance: 50px; /* fallback */
--distance: calc(hypot(var(--x), var(--y)) * 1px);calc(), clamp(), min(), and max(). Example: font-size: clamp(1rem, calc(sqrt(var(--viewport-width)) * 0.5rem), 4rem); You can also nest them: pow(sqrt(var(--x)), 3) = x1.5. This composability is what makes CSS math functions so powerful for creating flexible, responsive designs without JavaScript.Use trigonometric functions in CSS to create circular animations and layouts without JavaScript. See the code.
Full-featured scientific calculator with trigonometric, logarithmic, and exponential functions. Clean interface and keyboard support. No installation required.
Convert angles between degrees, radians, and grads. Quick reference for mathematics and engineering. Simple and ad-free.
Enter release height and speed to compute the optimal launch angle for maximum distance. Simple projectile model.
Enter the initial amount, half‑life, and time to find remaining quantity. Nuclear science helper.
Calculate the time needed to deposit a certain mass of metal using current. Chemistry lab tool.
Enter drum diameter, depth, and material to find the shell's approximate fundamental note. For tuning reference.
Select knife type and see recommended sharpening angle. Visual guide with degree display. Perfect edge every time.
Generate flowing geometric art by layering sine waves with different frequencies, amplitudes, and colors. Download SVG.
Calculate semester or cumulative GPA on a 4.0 scale. Add courses, credit hours, and letter grades. Instant calculation. No data storage.
Enter a password and see the estimated time it would take to crack using brute force at different speeds. Educational.
Estimate monthly mortgage payments with amortization schedule. Input loan amount, interest rate, and term. All calculations performed securely on your device.
Enter a chemical formula (e.g., H2O, C6H12O6) and calculate its molar mass. Handles parentheses and hydrates. Pure frontend.
Build a horizontal scroll‑snap container with configurable snap‑type and alignment. Perfect for image galleries.
Select the material you're drilling into and see the recommended point angle and lip clearance. Sharpen bits correctly.
Convert rabbit age to human years considering their rapid early maturation. Fun tool for house rabbit owners. Local only.
Enter log pile dimensions to calculate cords and face cords. Also estimate heat content in BTUs by wood species. Local reference.
Calculate your weekly, monthly, or annual pay based on hourly wage and hours. Include overtime rates. Accurate and private.
Enter room dimensions and number of walls to calculate needed 4x8 or 4x12 sheets, plus joint compound and tape estimate. Local tool.
Enter rolls remaining and household size to estimate weeks of supply. A humorous yet practical aid.
Select meat type and weight to get optimal brine time. Avoid over‑salting.
Classic solubility rules for ionic compounds in water. Determine if a salt is soluble or forms a precipitate. Static guide.
Convert guinea pig age to approximate human years. Cute facts included. For guinea pig lovers. 100% local.
Estimate due date from last menstrual period or conception date. Uses Naegele's rule and shows week-by-week milestones. Local calculator for informational use.
Advanced metronome with eighth, triplet, and sixteenth note subdivisions. Accent controls. Web Audio scheduling.
Enter total drive time or playlist length to figure out how many songs you need. Convert time to estimated tracks.
Track which stage of tumbling your rocks are in, record grit amounts, and get reminders for when to advance to the next grit.
Adjust recommended tire pressure for extra load or high speed. Simple reference chart.
Display a dynamic list of keyboard shortcuts for the current browser and operating system. Filter by category. Keep it open for reference.
Select species (Syrian, Dwarf) to get optimal sand bath frequency and duration. Keep your hamster's coat clean.