Skip to main content
L
Loopaloo
Buy Us a Coffee
All ToolsImage ProcessingAudio ProcessingVideo ProcessingDocument & TextPDF ToolsCSV & Data AnalysisConverters & EncodersWeb ToolsMath & ScienceGames
Guides & BlogAboutContact
Buy Us a Coffee
L
Loopaloo

Free online tools for developers, designers, and content creators. Your files are processed in your browser and are never uploaded - no accounts required. A few network utilities (like What's My IP and Currency Converter) call public APIs to do their job and say so on their pages.

support@loopaloo.com

Tool Categories

  • Image Tools
  • Audio Tools
  • Video Tools
  • Document & Text
  • PDF Tools
  • CSV & Data
  • Converters
  • Web Tools
  • Math & Science
  • Games

Company

  • About Us
  • Contact
  • Blog
  • FAQ

Legal

  • Privacy Policy
  • Terms of Service
  • Disclaimer

Support

Buy Us a Coffee

© 2026 Loopaloo. All rights reserved. Built with privacy in mind.

Privacy|Terms|Disclaimer
  1. Home
  2. Document & Text
  3. Code Syntax Highlighter
Add to favorites

Code Syntax Highlighter

Syntax highlight code in 22 languages and 7 themes as you type, then copy styled HTML or export an HTML page or a PNG image.

Text processed locallyMore document & textJump to full guide
Related readingKeyboard Shortcuts Every Developer Should Know9 minCode Minification: Reducing File Sizes for Faster Web Performance10 min

Initializing in your browser…

You might also like

QR Code Reader & Scanner

Read QR codes from a photo, a screenshot or your camera, several at once. Wi-Fi logins, contacts, events and links are laid out field by field, in your browser.

Image Color Palette Extractor

Extract the main colours of a photo as a palette with hex, RGB and HSL codes and their share of the picture, and export it as CSS, SCSS, Tailwind, JSON, CSV or GIMP.

Code Minifier & Beautifier

Minify or beautify JavaScript, TypeScript, CSS, HTML, JSON, XML and SQL as you type, without touching strings or licences, and see the bytes saved.

Code Syntax Highlighter: a worked example

A developer is writing a blog post about URL handling and needs the snippet highlighted correctly in a CMS that has no syntax highlighting.

JavaScript

const u = "https://example.com/a"; // real comment
const re = /\/\/ not a comment/g;
What Code Syntax Highlighter produces

Tokens as coloured

const                         keyword
u                             name
"https://example.com/a"       string
// real comment               comment
const                         keyword
re                            name
/\/\/ not a comment/g         regular expression

A highlighter that looks for // anywhere would colour the second half of the URL and the whole regular expression as comments. Reading the code as tokens keeps the URL inside its string and recognises the regular expression as one unit, so only the genuine comment is grey. Copy HTML then produces a <pre> block with these colours as inline styles, which the CMS displays as is.

About the Code Syntax Highlighter

Paste code in any of 22 languages and see it syntax highlighted in one of seven themes as you type. Copy the result as styled HTML for a blog, email or slide, or export it as a standalone HTML page or a PNG image.

How it works

Highlighted code is easier to read in documentation, tutorials, slides and bug reports, but getting colours into a place that does not support them, such as an email, a CMS editor or a presentation, usually means taking a screenshot. This tool produces the highlighted version in three portable forms: HTML with the colours written inline, a complete HTML page, and a crisp PNG image.

Accurate colouring. Each language is read by a tokenizer that follows the language's own rules for strings, comments, numbers and keywords, rather than by a set of search patterns. That matters for the cases simple highlighters get wrong: a URL such as "https://example.com" inside a string stays a string instead of turning the rest of the line into a comment, a JavaScript regular expression containing // is recognised as a regular expression, a SQL string with a doubled quote does not end early, and a multi-line comment or template literal is coloured across every line it spans. Under the preview, a check confirms that the highlighted tokens add up to exactly the text you pasted, so nothing is ever lost or reordered.

Languages and themes. Supported languages are JavaScript, TypeScript, Python, Java, C++, C#, Go, Rust, Ruby, PHP, Swift, Kotlin, HTML, CSS, SCSS, JSON, YAML, XML, SQL, Bash, PowerShell and Markdown. For SQL you can choose the dialect (SQLite, PostgreSQL, MySQL, SQL Server or Oracle), because they disagree on how strings and quoted names are written. Themes include Dark, Light, Monokai, GitHub Dark, Dracula, Nord and Solarized Dark. Line numbers, line wrapping and font size are adjustable, and opening a file picks the language from its extension.

Exports that keep their colours. Copy HTML puts a <pre> block on your clipboard with every colour written as an inline style, so it looks the same pasted into a blog post, a wiki or an HTML email, with no stylesheet needed. Export HTML saves a complete page with the theme background. Export PNG draws the code onto an image at up to twice the screen resolution, with tabs expanded so indentation lines up; very long files are scaled to fit, and files too long for a single image are pointed to the HTML export instead.

Honest about limits. For each language the tool states what its rules are based on and anything it does not recognise, for example JSX markup inside JavaScript, which is coloured as ordinary JavaScript. Highlighting runs entirely in your browser, so proprietary code is never uploaded.

How to use

  1. 1Choose the language and a theme, or open a file to pick the language from its extension.
  2. 2Paste or type your code, or press Try an example to load a sample in the selected language.
  3. 3Adjust the font size, line numbers and line wrapping until the preview looks right.
  4. 4Press Copy HTML to paste the styled code into a web page, email or document.
  5. 5Use Export HTML for a standalone page, or Export PNG for an image to put in slides or social posts.

Key features

  • 22 languages, from JavaScript and Python to SQL, YAML, PowerShell and Markdown
  • Seven themes: Dark, Light, Monokai, GitHub Dark, Dracula, Nord and Solarized Dark
  • Language-aware tokenizing, so strings, comments and regular expressions are coloured correctly
  • SQL dialect choice for correct string and identifier handling
  • Copy HTML with inline styles that keep their colours anywhere
  • Export a standalone HTML page or a high-resolution PNG image
  • Line numbers, word wrap and font sizes from 10 to 32 px
  • A check that the highlighted output matches the input exactly
  • Notes on what each language's rules do not cover
  • Runs locally; code is never uploaded

When to reach for this

  • Code in slides and social posts

    Export a sharp PNG of a snippet for a presentation, a tweet or a LinkedIn post, in a theme that matches your slides.

  • Blog posts and documentation

    Paste highlighted HTML into a CMS or wiki that has no syntax highlighting of its own.

  • Emails and support replies

    Send a readable, coloured code example in an email, where external stylesheets and scripts are not allowed.

  • Teaching and code review

    Show a highlighted excerpt with line numbers so students or reviewers can refer to exact lines.

Tips & best practices

  • Use a light theme for printed handouts and a dark theme for slides shown on a projector in a dim room.
  • Turn off line numbers for snippets people will copy, and turn them on when you want to refer to specific lines.
  • Keep PNG snippets short, around 10 to 30 lines, so the text stays readable when the image is resized.
  • Pick a font size of 18 px or more for slides; the PNG is drawn at the size you choose.

Examples

  • A URL inside a string

    In const u = "https://example.com/a"; // real comment, the URL is coloured as part of the string and only "// real comment" is coloured as a comment.

  • A tab-indented function as a PNG

    A function indented with tabs exports to PNG with each tab expanded to the next four-column stop, so nested blocks line up exactly as they do in an editor.

  • A SQL query in an email

    A PostgreSQL query copied with Copy HTML and pasted into an email keeps keyword, string and comment colours, because every colour is an inline style.

Frequently asked questions

Which languages are supported?

JavaScript, TypeScript, Python, Java, C++, C#, Go, Rust, Ruby, PHP, Swift, Kotlin, HTML, CSS, SCSS, JSON, YAML, XML, SQL, Bash, PowerShell and Markdown. JSX and TSX are highlighted as plain JavaScript and TypeScript.

How do I paste highlighted code into an email or a CMS?

Press Copy HTML and paste into the HTML or source view of your editor. The colours are written as inline styles on each piece of code, so they survive email clients and editors that strip stylesheets. In editors without an HTML view, export a PNG instead.

Why use this instead of a screenshot?

The PNG export renders the code at up to twice screen resolution with consistent padding and theme colours, without your editor's interface around it. The HTML export keeps the text selectable and searchable, which a screenshot cannot.

Is there a limit on length?

Highlighting and the HTML exports work for long files. A PNG has a maximum size in browsers, so long files are scaled down to fit, and a file too long for one image gets a message suggesting the HTML export or a shorter excerpt.

Why does the SQL dialect matter?

Databases write strings and quoted names differently. MySQL uses backticks and treats a backslash in a string as an escape, while others do not. Choosing the right dialect makes sure strings end where your database thinks they end, so the colours match how the query is actually read.

Is my code uploaded?

No. Highlighting and both exports are produced in your browser. The share link stores only the language, theme and display settings.

Related tools and how they differ

  • Code Minifier & Beautifier: Beautify minified code first, then highlight the readable version.
  • Markdown Editor & Preview: Write documentation in Markdown with fenced code blocks and export it as HTML.

Further reading

  • Keyboard Shortcuts Every Developer Should Know9 min read
  • Code Minification: Reducing File Sizes for Faster Web Performance10 min read

Private by design

Your text is processed locally in the browser. Nothing you paste or open is transmitted or logged.