rashidazarang/chatgpt-chat-exporter

A lightweight browser-based tool to export your ChatGPT conversations in beautiful Markdown or PDF format.

ChatGPT Chat Exporter

What it is – A browser‑side tool that lets you download the full content of a ChatGPT (and Google Gemini) conversation as clean Markdown, HTML, or a print‑ready PDF. It runs entirely in your browser – no server, no installation, no account required.

Key capabilities

  • Captures every message, even those that have been lazy‑loaded out of the DOM, by automatically scrolling the chat window.
  • Preserves sender labels, timestamps, uploaded files, generated downloads, and visible reasoning recaps.
  • Keeps rich content intact: code blocks (including CodeMirror), tables, MathJax/KaTeX equations, lists, links, images, and file‑card cards. Images are embedded when their bytes can be fetched (up to 20 MiB each).
  • Adds web‑search citations as a numbered References list, matching ChatGPT’s native copy output.
  • Exports to three formats:
    • Markdown (.md) – faithful whitespace, backslashes, and code‑fence handling.
    • HTML – retains all visual structure.
    • PDF – generated from a print‑optimized HTML page.
  • Works via a userscript (Tampermonkey/Violentmonkey/Greasemonkey) that adds “Export to Markdown” / “Export to PDF” items to ChatGPT’s native Share menu, with a fallback floating button for accounts that lack the Share control.
  • Alternatively, you can paste a single JavaScript file into the browser console to trigger an export.
  • Supports Google Gemini conversations through a similar console script.

How to use

  1. Userscript method (recommended) – install a userscript manager, add the Markdown and/or PDF userscript from GreasyFork or directly from the repo, then open a ChatGPT chat and choose the export option from the ••• menu, the header Share menu, or the floating button.
  2. Console method – open DevTools → Console, paste the appropriate exporter-*.js file (Markdown, HTML, or PDF) and press Enter. A download starts automatically, named after the conversation title.
  3. Gemini – open a Gemini chat, open the console, paste gemini-exporter-markdown.js, and press Enter.

Implementation notes

  • All exporters are generated from a single, tested extraction engine (src/extraction-engine.js). The engine uses a cascade of DOM selectors (data attributes, ARIA, semantic HTML, heuristics) to stay robust against UI changes.
  • The auto‑scroll sweep runs with a bounded time budget (default 120 s) and restores your original scroll position when finished.
  • No conversation data leaves your browser; the only network request is an optional fetch of image/file bytes from chatgpt.com using your existing signed‑in session.
  • By default the exported files do not embed the exact conversation URL, preserving privacy. You can opt‑in with includeSourceUrl: true.

Current status – Actively maintained (v0.9.2). Recent fixes include reliable handling of image‑only turns, preservation of per‑turn timestamps and file cards, and improved handling of long‑conversation exports.

Who might benefit – Anyone who wants a reliable, offline copy of their AI chat history for documentation, research, sharing, or archiving without relying on third‑party services.

Related

  • Project
  • Dispatch
  • Project
  • Project
  • Project