Beautifully syntax-highlight your code for blogs, presentations, documentation, and social media. Paste code in any of 20+ supported languages, and the tool instantly applies professional syntax coloring with proper keyword, string, comment, and number highlighting. Copy the result as styled HTML to paste directly into your blog or documentation, or use the visual preview for presentations.
| 1 | function greet(name: string): string { |
| 2 | // Return a greeting message |
| 3 | const message = `Hello, ${name}!`; |
| 4 | console.log(message); |
| 5 | return message; |
| 6 | } |
| 7 | |
| 8 | /* Multi-line comment example |
| 9 | with several lines */ |
| 10 | const count = 42; |
| 11 | const hex = 0xFF; |
| 12 | const pi = 3.14; |
Paste your code into the input textarea. Select the programming language from the dropdown menu (JavaScript, TypeScript, Python, HTML, CSS, JSON, SQL, Bash, Go, Rust, Java, C++, and more). The code is instantly highlighted with proper syntax coloring - keywords in purple, strings in green, comments in gray, numbers in orange, and functions in blue. Toggle line numbers on/off, adjust font size (12–18px), and enable word wrap if needed. Click 'Copy as HTML' to get the highlighted code as styled HTML for pasting into blogs and documentation.
Code syntax highlighting is used for: writing technical blog posts with properly colored code snippets, creating visually appealing code slides for presentations and talks, embedding highlighted code in documentation and README files, sharing code snippets on social media with professional formatting, creating code screenshots for tutorials and courses, formatting code for print materials and books, preparing code examples for educational content, and styling code blocks in email newsletters and reports.
The syntax highlighter uses a custom tokenizer that parses code into different token types: keywords (language-specific reserved words), strings (single and double-quoted), template literals, comments (single-line // and multi-line /* */), numbers (integers, floats, hex), functions/methods, types/classes, and operators. Each token type is assigned a specific color. The tokenizer runs as a single-pass regex-based lexer for optimal performance. The HTML output uses inline styles for maximum compatibility when pasting into external platforms like WordPress, Medium, or Google Docs.
The tool supports 20+ languages including JavaScript, TypeScript, Python, HTML, CSS, JSON, SQL, Bash, Go, Rust, Java, C++, C#, PHP, Ruby, Swift, Kotlin, YAML, XML, and Markdown. Each language has specific keyword definitions for accurate highlighting.
Click 'Copy as HTML' to copy the highlighted code as styled HTML with inline CSS. You can paste this directly into WordPress, Medium, Ghost, or any HTML editor. The inline styles ensure the colors display correctly regardless of the platform's default styles.
The tool uses a dark theme optimized for readability with colors that match the DevTools Online design: purple for keywords, green for strings, gray for comments, orange for numbers, blue for functions, and yellow for types. The dark background ensures maximum contrast.
Transform, format, generate, and encode data instantly. Private, fast, and always free.
Browse All Tools