Beautiful pseudocode for the Web

View the Project on GitHub SaswatPadhi/pseudocode.js

pseudocode.js enables JavaScript to typeset algorithms as beautifully as LaTeX does:

The demo above is editable. Feel free to experiment with it by clicking on the edit button.


pseudocode.js is a JavaScript library that typesets pseudocode beautifully to HTML:

It supports all modern browsers, including Chrome, Safari, Firefox, Opera, and IE 8 - IE 11.


Pseudocode.js supports multiple backends to render math formulas. If you want to include any math formulas in your pseudocode, please make sure that either KaTeX or MathJax is properly setup in your document.

Download pseudocode.js, and host the files on your server. And then include the js and css files in your HTML files:

<link rel="stylesheet" href="">
<script src=""></script>

Place the pseudocode to be rendered in a <pre> element:

<pre id="hello-world-code" style="display:hidden;">
    \PRINT \texttt{'hello world'}

Finally, call pseudocode.render by placing the following Javascript snippet at the end of your document body:


For more details on available options and backends, please see the usage section of README.


pseudocode.js was originally written by Tate Tian (@tatetian). Together with @ZJUGuoShuai, I (@SaswatPadhi) added the MathJax support, and I am the current maintainer of this project. Suggestions, bug reports and pull requests are most welcome.


Pseudocode.js is partially inspired by KaTeX and relies on it to render math formulas. Thanks Emily Eisenberg(@xymostech) and other contributers for building such a wonderful project.