There is no degree sign in base LaTeX math. The universal workaround is a superscript circle, ^\circ, which renders correctly in LaTeX, KaTeX and MathJax. The gensymb and siunitx packages add a proper \degree for full documents.
All ways to write it
^\circmath mode, works everywhereNo package needed\degreePackage: gensymbNot in KaTeX\textdegreetext modePackage: textcompNot in KaTeX\SI{90}{\degree}Package: siunitxNot in KaTeX
Commands marked with a package need that \usepackage line in a LaTeX document. “Not in KaTeX” means the command will not render in KaTeX- or MathJax-based tools such as Markdown previews, Jupyter and Confluence math apps; use one of the other forms there.
Example
\sin 30^\circ = \tfrac{1}{2}Thirty degrees written with the superscript-circle form.
Questions
How do I write °C in LaTeX?
In math mode: ^\circ\mathrm{C}. With siunitx: \SI{25}{\celsius}. In Confluence math macros use the first form.
Does \degree work in KaTeX or MathJax?
No. KaTeX and MathJax render ^\circ but not gensymb's \degree. That matters inside Confluence, Jupyter and most web renderers.
Using degree in Confluence
Confluence Cloud has no built-in LaTeX. With LaTeX Math for Confluence you add a math macro to any page, type ^\circ and it renders inline or as a block, with a live preview while you edit. The app uses KaTeX, so pick one of the commands above that is not marked “not in KaTeX”.