Image Tools

Code to Image

Turn code snippets into beautiful shareable images. Pick a theme, adjust font size and padding, and download as PNG for sharing on social media.

1
2
3
4
5
6
7
8
function greet(name) {
  0
  const message = 1 + name + 2;
  console.log(message);
  return message;
}

greet(3);

How it works

Your code is syntax-highlighted using a built-in lightweight tokenizer and rendered inside a styled preview element. The html-to-image library captures the rendered HTML as a 2x resolution PNG — exactly what you see on screen.

Frequently asked questions

What languages are supported?

JavaScript, TypeScript, Python, Go, Rust, CSS, HTML, JSON, Bash, and Plain text. Syntax highlighting is applied based on the selected language.

What themes are available?

Night Owl, GitHub Dark, Dracula, Monokai, Solarized Dark, and Light.

How do I share the image?

Click Download PNG to save the image, then share it on Twitter, LinkedIn, Instagram, or any platform that supports image uploads.

Is the syntax highlighting accurate?

It uses a lightweight regex-based highlighter built into the tool. For most common code patterns (keywords, strings, comments, numbers) it works well. For edge cases it may not be perfect.

Related tools