Interview QuestionsTable of Contents
Syntax Highlighter

Code Syntax Highlighter

Select your programming language and paste your Source code to get Syntax Highlighted code. You can use this form as tool to format your source code using HTML for Java2Html, Cpp2Html, CSharp2Html, C2Html, Vb2Html, Php2Html, Ruby2Html, Delphi2Html, Pascal2Html conversions and much more.


Source code to syntax highlight:


Copy-Paste your source code into above text area and click HIGHLIGHT. You will get HTML formatted version of your source code. On the resulting HTML page, right click and pick “View Source” to get the HTML text for your pretty printed source code.

How Does The Syntax Highlighter Work?

This page uses Geshi (thanks for developers). It posts the code to a php script which invokes Geshi to return the pretty print. It’s really easy thanks to Geshi!

We, the programmers, often write program code in user friendly IDEs such as Eclipse, JBuilder, Visual Studio that displays the source code in a visually appealing, clear and understandable way by highlighting different language constructs using different colors, or different fonts. The IDE handles this mundane detail gracefully and we take it granted. That is until the moment we need to display our code on the web for others to see.

One very much needed feature for all IDEs is to be able to export our source code as HTML while preserving the source code syntax highlighting. This is often a missing functionality because highlighting source code correctly is not a trivial task.

These tools typically need to have some understanding of the language syntax even if
they do not parse the language entirely to all available detail. However, in most cases,
one syntax highlighter, let us say built for Java, will not be usable to highlight the syntax of Delphi Pascal code.

Therefore, there are various tools created to parse individual languages such as Java, C#, PHP, Visual Basic, C++, Ruby and so on. For each language, they have facilities to
generate correct HTML. These tend to have names like Java2Html, J2Html, Cpp2Html,
C2Html, Php2Html, VB2Html, Ruby2Html, Delphi2Html and so on.

Downloading and maintaining a separate syntax highlighter on your computer makes little sense since these tools are typically not used often. Therefore, having online source code syntax highlighting tools makes sense. You can use syntax highlight tools from for free. You can copy paste your source code, pick your language
and hit submit. You will get back the pretty HTML right away. Enjoy!