Skip to content

Markdown

Export the code from a ChatGPT conversation

Keep indentation, language identifiers, and block boundaries — the three things that break when you copy code by hand.

chatgpt.com/share/<share-id>

No account, nothing stored. Files are built in your browser — revoke sensitive share links afterwards.

The converter is preset to Markdown. You can change the format at any time.

Why this format

  • Indentation survives intact

    Leading whitespace is preserved exactly, so Python and YAML don't arrive broken.

  • Language identifiers are kept

    Each fence keeps its language, so your editor highlights the block the moment you paste it.

  • Block boundaries stay clear

    Explanatory prose never bleeds into a code block, which is the usual result of a manual drag-select.

  • One file, every snippet

    Filter to assistant messages and export once instead of clicking Copy on twenty separate blocks.

Example output

snippets.mdmarkdown
```typescript
interface ConversationService {
  fetchConversation(shareUrl: string): Promise<NormalizedConversation>;
}
```

```bash
curl -s "$SHARE_URL" | node scripts/normalize.mjs > thread.json
```

Step by step

  1. 01Paste the public share link and load the conversation.
  2. 02Use the 'Assistant only' filter, since code almost always lives in the replies.
  3. 03Search the preview for a language name to find the block you want, then deselect the rest.
  4. 04Export as Markdown to keep fences, or JSON if a script will consume the snippets.

Tradeoffs and limits

  • Inline code inside a sentence stays inline rather than becoming its own block.
  • Blocks with no declared language are exported as plain fences.
  • Code is exported as written in the conversation — it is not compiled, linted, or verified.

Files are generated in your browser. Nothing is stored.

Questions about this export