Back to articles

    How to Share Code on Twitter (X) and LinkedIn as an Image

    November 14, 2026•11 min read•Tutorial

    Turn a code snippet into a readable image for X and LinkedIn: when to post text or a link instead, theme and font choices, export sizes and alt text.

    Picbolt Screenshot Tool

    To share code on X (Twitter) or LinkedIn:

    1. Turn the snippet into an image and attach it to your post.
    2. Put the code, or a short summary of it, in the image's alt text.
    3. Link the full source.

    A code image generator gives you syntax colors, a clean window frame and a fixed export size such as 1920×1080 (16:9) or 1080×1080 (1:1). In our code image generator, you pick the language first, paste your code, choose a theme, set the aspect ratio and click Save.

    Image, text or a link: which to post

    An image is the most readable way to show a block of code in a feed. It also has costs: readers can't copy it, and screen reader users get nothing from it unless you add alt text. Pick based on what you want people to do with the code.

    FormatSyntax colorsReaders can copy itWorks with screen readersBest for
    Plain-text postNoYesYesOne-liners, commands, a short config value
    Link to a gist or repoOn the linked pageYesYesAnything longer than a screen, code people will run
    Editor screenshotYour editor's themeNoOnly with alt textQuick posts where your editor's look is fine
    Code image from a generatorYes, any themeNoOnly with alt textShort snippets meant to be read and shared

    The usual answer is all three together:

    • a code image so the snippet is readable in the feed
    • alt text so screen reader users get the content
    • a link to a GitHub Gist or your repo so people can copy the code

    Plain text in a post has no syntax colors, and spacing and indentation may not survive. It suits single lines better than blocks.

    Quick method: screenshot your editor

    If your editor already looks the way you want, a plain screenshot works.

    • Mac: press ⌘⇧4 (Command-Shift-4) and drag around the code.
      • To capture a whole window instead, press Space after ⌘⇧4.
      • To copy the capture to the clipboard instead of saving a file, add Control (⌃⌘⇧4).
    • Windows: press Windows-Shift-S and select the area.

    What a plain screenshot can't do:

    • Text size: you get whatever size your editor shows. Increase the editor's font size or zoom before you capture.
    • Clutter: sidebars, tabs, error squiggles and anything else on screen end up in the image unless you crop carefully.
    • Image size: it depends on your display, not on what fits the feed.
    • Private details: it's easy to capture a token, a file path or a client name you didn't mean to share.

    You can keep your editor's exact look and still add a background and window frame. Paste the screenshot into our screenshot mockup editor. Free exports from that editor carry a "Made with Picbolt" watermark. Images from the code generator don't.

    Share code on Twitter or LinkedIn: make the image in Picbolt

    The code image generator runs in your browser and needs no sign-up. The image is rendered in your browser, and your code isn't sent to our server to make it.

    1. Open the code image generator.
    2. In the Edit tab, under LANGUAGE, choose your language before you paste anything. Changing the language later replaces the code with a sample in that language.
    3. Click into the code block on the canvas and select the sample text with ⌘A (Command-A, or Ctrl+A on Windows).
    4. Paste your snippet with ⌘V (Command-V, or Ctrl+V on Windows).
    5. Under THEME & FONT STYLE, pick a theme and a font.
    6. Adjust Font size (4 to 30, default 15). Aim for the longest line to nearly reach the right edge of the code window.
    7. Under FRAMES, pick a window style such as macOS Dark or Windows Light. With macOS and Windows frames, you can click the title and type a filename.
    8. Open the BG tab and choose a background.
    9. Click the aspect-ratio button in the top bar and choose 16:9 Youtube Video or 1:1 Instagram Post (Square).
    10. Open the Settings tab and leave Format on PNG. Type a FILE NAME if you want one.
    11. Click Save to download the image. Nothing on /code is saved when you close the tab. Finish the image in one sitting, or keep the snippet somewhere else.

    On the free plan, code images:

    • have no watermark
    • export at 1x in PNG or JPEG
    • count toward the 3 downloads a day

    The one-time Lifetime plan adds 2x to 8x exports and the WEBP and SVG formats. See Free vs Lifetime.

    Make code readable in the feed

    Assume your image will be seen on a phone, scaled down to the width of the screen. Everything below follows from that.

    Show only the lines that make the point

    Cut imports, setup and unrelated functions. Replace skipped parts with a comment such as // ... so readers know something is missing. A short, focused snippet can use a bigger font, and font size matters more than any theme choice.

    Break long lines yourself

    Long lines wrap automatically in the code editor. Wrapped code is hard to follow, especially in indentation-sensitive languages like Python. Break lines where a reader would expect it:

    // Hard to read once it wraps
    const active = users.filter(u => u.isActive && !u.isBanned).map(u => u.email).sort();
    
    // Reads cleanly at a larger font size
    const active = users
      .filter(u => u.isActive && !u.isBanned)
      .map(u => u.email)
      .sort();
    

    Shorter lines also let you raise the font size before anything wraps.

    Give the code the space

    • Padding: lower it so the code window takes up more of the image.
    • Tilt and TRANSFORMS: keep the code flat. Both add 3D perspective, which makes text smaller on one side.
      • To remove a transform, click it again.
      • To return to flat after tilting, toggle Tilt.
    • Rotate: leave it at 0.

    Check it at real size

    Before you post, open the exported file on your phone and view it at full width without zooming. If you have to zoom to read it, cut lines or raise the font size.

    Clean the code before you share it

    Remove API keys, tokens, internal URLs and customer names. Edit them out of the text itself rather than blurring them in the image. A code image is public the moment you post it.

    Pick a theme and font

    Picbolt has 19 themes:

    • Dracula, Monokai, Okaidia, Darcula
    • Android Studio, Atomone, Github Dark, Github Light
    • ABCDEF, Aura, Nord, Tomorrow Night Blue
    • VS Code Dark, Material Dark, Gruvbox Dark
    • Console Dark, Console Light, Xcode Dark (default), Xcode Light

    A few practical rules:

    • Check the comment color. Comments are often the lowest-contrast color in a theme. If the key idea is in a comment, make sure it's still readable on your phone.
    • Choose dark or light by readability. People use X and LinkedIn in both dark and light mode, so neither choice matches everyone. Pick the one where your code reads most clearly.
    • Stay consistent. If you post code regularly, use the same theme and font each time so your posts are recognizable.

    There are 10 monospace fonts: JetBrains Mono (default), Fira Code, Source Code Pro, IBM Plex Mono, Space Mono, Roboto Mono, Ubuntu Mono, Inconsolata, Anonymous Pro and Cousine. Whichever you choose, check that these characters look clearly different in your snippet:

    • 0 and O
    • 1, l and I

    If your language shows as plain text, see the troubleshooting section below.

    Frames and backgrounds

    A window frame tells readers at a glance that the image shows code. The FRAMES options are:

    • None
    • Arc Light and Arc Dark
    • macOS Dark and macOS Light
    • Windows Dark and Windows Light
    • Photograph

    The macOS and Windows frames add window buttons and an editable title. The title is a good place for the filename (useDebounce.ts, schema.sql), which gives readers context without extra post text.

    The BG tab has 102 gradients, 9 mesh gradients, 46 solid colors, textures, patterns and photos. The default on /code is a pale green solid (#BAFFC9).

    • Contrast: choose a background that contrasts with the theme's own background so the window edge stays visible. A dark theme on a dark background looks like a floating block of text.
    • Busy images: avoid busy photos and patterns behind code. The background should frame the window, not compete with it.
    • Transparent: skip it for social posts. You don't control what shows behind the transparent area, and it can change with each reader's dark or light mode.
    • Round and SHADOW: fine at their defaults. They don't affect readability.

    Export at 16:9 or 1:1

    Choose the shape based on the snippet, not the platform.

    Aspect ratio labelSize at 1xUse it for
    16:9 Youtube Video1920×1080Short snippets with fairly wide lines
    1:1 Instagram Post (Square)1080×1080Taller snippets, roughly as many lines as characters wide
    4:5 Instagram Portrait1080×1350Longer snippets with short lines
    Auto (default)1080 px wideWhen you'd rather the image follow the content

    A taller image can fill more of a phone screen, but platforms may crop tall images in the feed preview. For current sizes and cropping, see Twitter (X) image size and LinkedIn post image size.

    Export settings that matter:

    • Format: use PNG. JPEG compression can leave smudges around sharp text edges.
    • Save vs Copy: use Save for posting. It downloads at the full aspect-ratio size. Copy puts a PNG on your clipboard at the on-screen canvas size, which can be smaller.
    • Quality: the free plan exports at 1x, which gives 1920×1080 at 16:9. Lifetime can export at 2x and above (16:9 at 2x is 3840×2160).
    • Safari: downloads in Safari are always PNG data at the on-screen size, whatever format you choose. For a full-size file, use another browser.

    Without alt text, people using screen readers get nothing from a code image. And nobody can copy code out of a picture. Fix both in the post itself.

    What to write in the alt text

    • Short snippet: paste the code itself as the alt text, with the language name first, for example "JavaScript:" followed by the code.
    • Longer snippet: describe what the code does in a sentence or two, then point to the link in the post. For example: "A React hook that debounces a value by 300 ms and cleans up its timer on unmount."
    • Avoid: "image of code". It tells the reader nothing.

    Where to add it

    • X: after attaching the image, open the alt text option on the image preview before you post.
    • LinkedIn: after adding the image, look for the alternative text option while editing the image, before you post.

    The exact labels vary between the apps and the web versions.

    Put a link to a gist, a repo file or your blog post in the post text or in the first reply. Readers can then copy and run the code. Your image can stay short because the full version is one click away.

    Other code image tools

    We make Picbolt, so weigh our view accordingly. These tools are worth knowing:

    • Carbon and Ray.so: dedicated code-to-image sites. We compare them in Carbon vs Ray.so.
    • Chalk.ist: makes only code images, with themes, backgrounds and window styles. As of November 2026, it's free and open source under the MIT license.
    • CodeSnap: a VS Code extension for screenshots of your code without leaving the editor.
      • At least one community fork lists line numbers among its features. Picbolt doesn't offer line numbers.
      • As of November 2026, several forks are listed as free on the VS Code Marketplace.

    Picbolt is a good fit if you also make screenshot mockups, device frames or social post images and want them in one place. If you only ever make code images, any of the tools above may be all you need. For a fuller comparison, see best code screenshot tools.

    To show code next to a UI screenshot, or add arrows pointing at a line, use the Design Canvas. It has code layers alongside image, text and arrow layers. Two differences from /code:

    • Code layers support 10 languages.
    • Free exports from the Design Canvas carry the watermark.

    If it doesn't work

    Your code was replaced with a sample

    You changed LANGUAGE after pasting. Paste your code again, and next time set the language first.

    There are no syntax colors

    Yaml, Vue and Svelte are in the list but show as plain text. The highlighted languages are HTML, CSS, JavaScript, Python, Java, C++, Rust, SQL, JSON, Wast, Xml, Markdown, PHP and C#. There's no automatic detection, so check that the right language is selected. For other languages, pick the closest one and check the result, or use a tool that supports your language.

    The text looks small or soft on your phone

    Try these, in order:

    1. Cut lines and break long lines.
    2. Raise Font size and lower Padding.
    3. Export as PNG with Save, not Copy.
    4. Download from a browser other than Safari.

    "You've reached your daily limit of 3 downloads."

    On the free plan, Save and Copy both count, per browser. A download is counted when you click, so a failed export still uses one. The count resets at the start of the next calendar day, so finish your edits before you click.

    An "Upgrade to Lifetime Plan" window opens when you change Quality or Format

    2x and higher, WEBP and SVG are part of the Lifetime plan. PNG or JPEG at 1x works on the free plan.

    "Failed to copy image. Please try again."

    Your browser couldn't write to the clipboard.

    1. If the button stays on "Saving", copy your code somewhere else first. The editor won't keep it.
    2. Reload the page.
    3. Paste your code back in and use Save instead of Copy.

    FAQ

    Can I show line numbers in a Picbolt code image? No. Line numbers are always off on /code. To refer to a specific line, mention it in the post text.

    Do Picbolt code images have a watermark? No. Code images have no watermark on any plan. On the free plan, they still count toward the 3 downloads a day.

    Is my code uploaded anywhere? The image is rendered in your browser, and your code isn't sent to our server to make it. Once you post the image, though, it's public, so remove secrets first.

    Should I post a code image on LinkedIn too? Yes. The same rules apply: a short snippet, a large font, alt text and a link to the full code. LinkedIn posts don't give you syntax colors, so an image is usually the most readable way to show a block of code there.

    For code in presentations and docs, where people read at a different distance, see how to add code to slides and docs readably.

    Share this article