The short answer: 1080 × 1080, a 1:1 ratio. That is the shape that fills a post on LinkedIn without cropping, and it is the one to use unless you have a reason not to.

Why 1:1

LinkedIn's feed is overwhelmingly mobile and vertical, so square and 4:5 both hold their size where a wide 16:9 image shrinks to a strip. Square is the safer default because it renders predictably in the feed and in the preview shown when someone shares your post onward.

The settings

In Codeshot, under Aspect Ratio, switch from Original to Fixed and pick the 1:1 shortcut. Then set the width to 540 and export at .

That gives you exactly 1080 × 1080. Exporting at 2× rather than 1× is what keeps small text sharp on a retina display — a 1× export of a code snippet always looks slightly soft.

Other sizes that work

Ratio Pixels Use it when
4:5 1080 × 1350 you want the post to occupy more of the screen

Each is the same three settings: the ratio, a width, and a 2× export.

The mistake to avoid

Using a wide landscape ratio because it suits the code. A 16:9 snippet on LinkedIn mobile ends up small enough that the text is unreadable, which defeats the point. Trim the snippet until it fits a squarer frame instead.

One more thing

LinkedIn compresses images noticeably. Exporting at 2× rather than 1× gives the compressor more to work with and keeps the text crisp.

Sizes for other platforms

See all articles for the rest, including the other platforms.

Whichever platform you post to, the theme matters as much as the size once the image is scaled down. You can compare all 30 before you pick one.