How to Share Code on LinkedIn (So People Actually Read It)

LinkedIn is where developers get noticed by recruiters, clients and other engineers. A short post explaining a trick you learned, with the code in it, can do surprisingly well. But LinkedIn doesn’t format code: paste it into a post and the indentation collapses, the colours vanish and it’s hard to read. A clean code image fixes that, and it stops people scrolling past.

This guide shows how to share code on LinkedIn the right way: a readable code image, the right size for the feed, and a post that gets developers to engage.

The quick answer

  1. Open Snippy, Doetra’s free code screenshot tool, and paste your code or open a file.
  2. Pick only the lines that matter, and choose a theme (there are 66).
  3. Set the canvas to a LinkedIn-friendly shape (square or 4:5 portrait works well in the feed).
  4. Export a PNG at 2× and add it to your LinkedIn post, with the code itself in the first comment or a gist link.

It’s free with no sign-up, and your code never leaves your browser.

Why images, not pasted code?

Code pasted as textCode as an image
IndentationOften collapsesExactly as written
Syntax coloursNoneYour chosen theme
Stands out in the feedLooks like a wall of textEye-catching
CopyableYesNo; put the text in a comment or link
AccessibleScreen readers read itAdd alt text describing the code

Best of both: post the image for readability, and put the copyable code in the first comment or in a GitHub gist.

Step by step

1. Choose a small, focused snippet

The best LinkedIn code posts show one idea in 5–20 lines. Cut boilerplate, imports and logging. If you open a whole file in Snippy, select just the lines that matter; the rest stays hidden.

2. Pick a theme

Choose from 66 themes. Dark themes like GitHub Dark stand out in LinkedIn’s light feed; light themes look clean if your brand is light. Stick to one theme for all your posts so people recognise them.

3. Make it readable on a phone

  • Turn on line wrapping so long lines don’t run off the image.
  • Keep lines under about 60 characters.
  • Use a larger font size than you would in your editor.
  • Show line numbers if you’ll refer to them in the post text.

4. Set the window and canvas

Give the file a name in the window bar (such as useDebounce.ts); it adds context. Choose a canvas shape and padding that suit the feed.

ShapeSizeBest for
Square1080 × 1080Most code snippets
Portrait 4:51080 × 1350Longer snippets; takes more space in the mobile feed
Landscape1200 × 627Short one- to five-line tricks

5. Export

Export a PNG at 2× or more for sharp text. JPG makes smaller files; SVG is perfect for blog posts and docs, where text stays crisp at any zoom.

Write a post people read

  • Lead with the problem. “Your search box fires an API call on every keystroke. Here’s a 10-line fix.”
  • Explain the key line in plain words below the image.
  • Ask a question at the end: “How do you handle this in your stack?”
  • Put the code in the first comment so people can copy it.
  • Add alt text to the image (LinkedIn lets you), describing what the code does.
  • Use 2–3 hashtags like #javascript #react #webdev.

Frequently asked questions

How do I share code on LinkedIn?

Turn the snippet into an image with Snippy, add it to your post, and put the copyable code in the first comment.

What size should a LinkedIn code image be?

1080 × 1080 (square) or 1080 × 1350 (portrait) works well in the feed.

Is my code uploaded?

No. Snippy runs entirely in your browser.

Can I export SVG?

Yes, as well as PNG and JPG, at up to 4×.

Try it: Make a code image for LinkedIn →

Scroll to Top