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.
Generate flowing geometric art by layering sine waves with different frequencies, amplitudes, and colors. Download SVG.
Create smooth, animated CSS waves (like water or sound) by adjusting amplitude, colors, and speed. Copy the ready‑to‑use SVG/CSS code.
Convert 3-digit capacitor codes (like 104, 222) to capacitance value in pF, nF, µF. Also converts back. Useful for reading tiny ceramic capacitors.
Check which cipher suites a website supports and identify weak or outdated ones. Quick security audit from your browser.
Paste HTML and instantly remove all tags, leaving only the text content. Optional keep line breaks. Quick cleaning.
Encrypt and decrypt text using the browser's Web Crypto API. Supports AES‑GCM and subtle key generation. No server required.
Generate Argon2id hashes in the browser using a WASM compilation. Choose memory, iterations, and parallelism. Secure local hashing.
Upload a font file or specify a URL and generate the complete @font‑face rule with modern formats and font‑display. Copy instantly.
Create a 'drawing' effect for any SVG path. Adjust speed and delay. Copy the CSS and SVG code. No JS needed.
Generate strong, memorable passphrases using the Diceware word list (EFF). Choose number of words. Cryprographically random selection. Privacy guaranteed.
Generate ultra-secure, random passwords with configurable length and character sets. Created entirely on your device; never transmitted or stored.
Write notes that are encrypted in your browser before saving to localStorage. Only accessible with your passphrase.
Convert HTML to plain text while preserving paragraph breaks. Remove images, links, and scripts. Quick data extraction.
Sign a message with a private key and verify the signature with the public key. Learn digital signature flow.
Assign a CSS class to any emoji and generate a snippet that displays the emoji as a background image or pseudo element. Useful for icon systems.
Upload an image and convert it into a paint-by-numbers outline with numbered palette. Adjust complexity. Print and paint. Local processing.
Generate and print custom calligraphy practice sheets with adjustable x-height, slant angle, and base line. Perfect for copperplate or Spencerian.
Generate a random, completely fake analytics dashboard snippet. 'Bounce rate: 98% from Mars.' Geeky humor.
Use your webcam to record a video clip and download it as WebM. Adjust resolution and see a preview. Works offline.
Use your webcam to record a video clip and download it as WebM. Adjust resolution. Works offline. Privacy‑friendly.
Decode a message hidden in a string of emojis (each emoji maps to a letter). Fun game for kids. Create your own.
Draw and edit SVG vector graphics in the browser. Basic shapes, text, and freehand. Export raw SVG code or as a file. No server, fully local.
Generate a hardboiled film noir plot with a detective, a dame, and a McGuffin. Great for creative writing prompts.
Convert your text into a string of emojis using a simple substitution cipher. Share secret messages that look fun. Decode them with the same tool. All local.
Check if a website is globally reachable or experiencing issues. Status code and latency displayed. Quick browser-side test.
Enter an amount and see a virtual stack of $100 bills with height comparison to everyday objects.
Encrypt and decrypt text using AES in the browser with a password. Uses Web Crypto API. No data sent to server.
Paste an HTML snippet and convert it into an SVG image that visually replicates the DOM. Useful for creating static snapshots. Local canvas rendering.
Enter a URL to see exactly what Open Graph and Twitter card tags will be shown when shared on social media. Fetch from browser.