LaTeXML is a project developed at NIST that converts LaTeX files into accessible HTML documents. It is quite advanced and is used by arXiv.org for their experimental automatic conversion of preprints to HTML.
Project links:
Conversion examples:
If you are comfortable with the command line, the workflow typically involves two steps:
latexml --dest=yourfile.xml yourfile.tex
latexmlpost --dest=yourfile.html yourfile.xml
Here is an example.
latexmlc --dest=yourfile.html yourfile.tex
LaTeXML converts mathematics to MathML. Depending on browser support, this may render natively. Alternatively, you can instruct LaTeXML to use MathJax for more consistent presentation across browsers:
latexmlpost --format=html5 \
--javascript='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=MML_CHTML' \
--dest=yourfile.html yourfile.xml
Here is example using MathJax.
Installation is generally straightforward. See the official instructions at:
https://math.nist.gov/~BMiller/LaTeXML/get.html
While this is not listed officially, you cal also install it using homebrew.
brew install latexml
For full functionality (for example, to support graphics conversion), you may also need:
Setting these up can be a bit involved. A simpler alternative is to edit the resulting HTML directly and insert images manually afterward.
LaTeXML supports many standard LaTeX classes and packages (see the list at included bindings).
Some classes, such as exam.cls, are not officially supported. However, it is possible to create bindings for unsupported classes, even with the help of AI tools. (One can even use AI to create bindings: this working—though not perfect—binding for exam.cls was created with claude.ai.)
Also have a look at arXiv.org's LaTeX markup best practices for HTML conversion using LaTeXML:
https://info.arxiv.org/help/submit_latex_best_practices.html.