Cube root in code
Unicode escapes, HTML entities, LaTeX — and the actual functions that compute a cube root in JavaScript, Python, Excel, and half a dozen other languages, including where it diverges from square root on negative numbers.
Unicode escapes & HTML entities
∛ is Unicode code point U+221B. Most languages let you drop it straight into a string literal using an escape sequence instead of pasting the raw character. Unlike √, it has no named HTML entity — only the numeric form.
"\u221B" // ∛"\u221b" # ∛"\u221B" // ∛∛ (no named entity)content: "\221B";LaTeX
\sqrt renders a proper radical with a bar over its argument in LaTeX, MathJax, and KaTeX — the bracketed 3 is what makes it a cube root instead of a square root.
\sqrt[3]{x}\sqrt{x}\sqrt[n]{x}Calculating a cube root in code
An escape sequence just gets the symbol onto the page — it doesn't compute anything. Here's the actual function or formula for each language and its result on 27 and -27, since cube root is one of the few operations where negative inputs are a real, well-defined case.
Math.cbrt(27);
// 3
Math.cbrt(-27);
// -3 — correct, unlike Math.pow27 ** (1/3)
# 3.0
(-27) ** (1/3)
# complex! see gotchas below=SIGN(A1)*ABS(A1)^(1/3)Math.cbrt(27);
// 3.0
Math.cbrt(-27);
// -3.0 — correct#include <math.h>
cbrt(27);
// 3
cbrt(-27);
// -3 — correctpow(27, 1/3);
// 3
pow(-27, 1/3);
// NAN — see gotchas belowSELECT CBRT(27);
-- 3
SELECT CBRT(-27);
-- -3, correctSELECT SIGN(27) * POWER(ABS(27), 1.0/3);
-- 3 (no native CBRT)import Foundation
cbrt(27.0)
// 3.0 — no .cubeRoot() method existssign(-27) * abs(-27)^(1/3)
# -3 (no built-in cbrt())Gotchas worth knowing
Negative numbers: cube root and square root behave completely differently
The cube root of a negative number is a real number (∛-27 = -3), unlike the square root of a negative number, which is imaginary. But most languages' naive x ** (1/3) doesn't know that: JavaScript's Math.pow(-27, 1/3) returns NaN, and Python's (-27) ** (1/3) returns a complex number rather than -3. Dedicated functions like JavaScript's Math.cbrt(), Java's Math.cbrt(), and C's cbrt() get it right; the generic power operator usually doesn't.
Python's ** operator returns a complex number for negative bases
(-27) ** (1/3) in Python doesn't raise an error or return -3 — it returns a complex number, something like (1.5+2.598j), because Python's ** falls back to complex arithmetic whenever a negative base is raised to a non-integer power. math.pow(-27, 1/3) is different again: it raises a ValueError. To get a real -3, use math.copysign(abs(x) ** (1/3), x) or write a small helper.
Excel and Google Sheets have no CBRT function
There's no built-in cube root formula in either app. =A1^(1/3) works for positive numbers but returns a #NUM! error for negative ones. The formula that handles both is =SIGN(A1)*ABS(A1)^(1/3): it computes the cube root of the absolute value, then reapplies the original sign.
Swift has no .cubeRoot() method
Double has a built-in .squareRoot() method (25.0.squareRoot()), but there's no equivalent .cubeRoot() for cube root — you have to import Foundation and call the global cbrt() function instead: cbrt(27.0).
SQL dialects disagree on whether CBRT exists
PostgreSQL has a native CBRT() function that handles negative numbers correctly. MySQL and SQL Server don't have one at all — you have to build it from POWER() and SIGN(), the same workaround spreadsheets need.
Just need the symbol itself?
The copy formats page has ∛ ready to paste as plain text, a Unicode code point, or a spreadsheet formula — no code editor required.
Open copy formatsFrequently asked questions
What is the Unicode escape for the cube root symbol in code?
In JavaScript, Java, and C# string literals, use \u221B (capital B). In Python, use \u221b. Both resolve to the same character, ∛, which is Unicode code point U+221B — one code point after the square root symbol, U+221A.
How do I calculate a cube root in JavaScript?
Use Math.cbrt(x) — for example Math.cbrt(27) returns 3. Unlike Math.sqrt(), it correctly handles negative numbers too: Math.cbrt(-27) returns -3. Don't use Math.pow(x, 1/3) as a substitute — Math.pow(-27, 1/3) returns NaN, since it doesn't know cube roots of negative numbers are well-defined.
How do I calculate a cube root in Python?
For positive numbers, 27 ** (1/3) or math.pow(27, 1/3) both work and return 3.0. For negative numbers it gets tricky: (-27) ** (1/3) returns a complex number rather than -3, and math.pow(-27, 1/3) raises a ValueError. To get a real result for any sign, use math.copysign(abs(x) ** (1/3), x).
What's the Excel or Google Sheets formula for cube root?
Neither app has a built-in CBRT function. Use =SIGN(A1)*ABS(A1)^(1/3), which works for both positive and negative numbers. A plain =A1^(1/3) works for positive inputs but returns a #NUM! error for negative ones.
What's the LaTeX command for a cube root?
\sqrt[3]{x} renders a radical with a small 3 in the index position and a bar over x. Dropping the bracketed number, \sqrt{x}, renders a plain square root instead. Works in LaTeX, MathJax, and KaTeX.
Why does Math.pow(-27, 1/3) return NaN instead of -3?
Math.pow() (and the equivalent in most C-family languages) implements exponentiation generically using logarithms, which are undefined for negative bases — so it returns NaN rather than recognizing that this particular case, a real cube root, has a well-defined answer. Dedicated cube-root functions like Math.cbrt(), Java's Math.cbrt(), and C's cbrt() are implemented separately and handle negative inputs correctly.