Skip to content

ChatGPT Conversations to Markdown is a Python script that converts your exported ChatGPT conversations into readable and well-formatted Markdown files.

Notifications You must be signed in to change notification settings

daugaard47/ChatGPT_Conversations_To_Markdown

Repository files navigation

ChatGPT Conversations to Markdown

Transform your exported ChatGPT conversations into beautifully formatted Markdown files optimized for Obsidian and other markdown readers.

Two ways to use this tool:

  • 🌐 Browser-Based Converter (Recommended) - Easy, no installation required
  • πŸ’» Python Script - For terminal users who prefer command-line tools

Both handle the complete ChatGPT export including conversations, images, DALL-E generations, and all attachments.

πŸš€ Quick Start (Recommended)

Browser-Based Converter (No Installation!)

πŸ“₯ Download chatgpt-markdown-converter.html (Right-click β†’ Save As)

Then:

  1. Open the downloaded HTML file in your browser (Chrome, Firefox, Safari, Edge - all work!)
  2. Upload your ChatGPT export ZIP file
  3. Configure your preferences (name, organization mode, formatting)
  4. Convert - all processing happens in your browser (nothing uploaded!)
  5. Download your organized markdown files

That's it! No Python, no terminal, no dependencies. Everything runs locally in your browser.

πŸ’‘ Privacy First: All processing happens in your browser. Your conversations never leave your computer.


✨ Features

Core Functionality

  • Complete ChatGPT Export Processing - Handles the entire ChatGPT data export including all files and folders
  • Multimodal Content Support - Automatically extracts and embeds images, screenshots, and attachments
  • DALL-E Image Organization - Separate handling for AI-generated images
  • Smart File Organization - Creates conversation-specific folders for all attachments

Message Format Support

  • Regular Messages - Standard user and assistant conversations
  • Audio Messages - Voice conversations embedded with HTML5 audio players
  • Internal Reasoning - ChatGPT's thinking process with special formatting
  • Reasoning Summaries - Brief reasoning recaps
  • Tool Calls & Execution - ChatGPT tool usage tracking
  • Tool Results - External tool response messages
  • User Context - Profile and instruction context
  • Code Blocks - Properly formatted code with syntax highlighting support

Obsidian Optimization

  • YAML Frontmatter - Searchable metadata with title, creation date, update date, and tags
  • Callout Syntax - Beautiful callouts for special content types:
    • > [!note] for internal reasoning
    • > [!info] for reasoning summaries
    • > [!abstract] for user context
  • Embedded Images - Relative paths for portability
  • Cross-Platform Compatibility - Works on Windows, macOS, and Linux

Customization Options

  • Customize user and assistant display names
  • Toggle Obsidian frontmatter and callouts
  • Include or exclude conversation dates
  • Custom date formatting
  • Custom filename templates
  • Configurable message separators
  • Skip empty messages option

πŸ’» Python Script (Alternative Method)

For users who prefer terminal/command-line tools:

Prerequisites

  • Python 3.7 or higher
  • ChatGPT data export (see instructions below)

Installation

One-Command Install:

Windows:

curl -sL https://raw.githubusercontent.com/daugaard47/ChatGPT_Conversations_To_Markdown/main/install.bat -o install.bat && install.bat

Mac/Linux:

curl -sL https://raw.githubusercontent.com/daugaard47/ChatGPT_Conversations_To_Markdown/main/install.sh | bash

OR Manual Installation:

git clone https://github.com/daugaard47/ChatGPT_Conversations_To_Markdown.git
cd ChatGPT_Conversations_To_Markdown
pip install -r requirements.txt

Python Usage

  1. Run setup wizard (first time only):
python setup.py
  1. Convert conversations:
python chatgpt_json_to_markdown.py
  1. Done! Open your MarkdownFiles folder

πŸ“₯ Getting Your ChatGPT Data

  1. Go to ChatGPT Settings β†’ Data Controls
  2. Click "Export data"
  3. Wait for the email from OpenAI (usually arrives within a few hours)
  4. Download the ZIP file from the email
  5. Keep the ZIP file - no need to extract! The setup wizard will handle it.

What Happens During Conversion

Both methods will:

  • βœ… Process all your conversations (could be 100s!)
  • βœ… Organize by your chosen mode (flat/category/date/hybrid)
  • βœ… Copy and organize all images β†’ Assets/Images/
  • βœ… Copy and embed all audio β†’ Assets/Audio/
  • βœ… Separate DALL-E images β†’ Assets/DALLE/
  • βœ… Create markdown files with embedded media
  • βœ… Generate Obsidian-compatible frontmatter
  • βœ… Show progress during processing

πŸ“ Output Structure

The script supports 4 organization modes (choose during setup):

Hybrid Mode (RECOMMENDED) ⭐

MarkdownFiles/
β”œβ”€β”€ Assets/
β”‚   β”œβ”€β”€ Images/        (all screenshots, uploaded images)
β”‚   β”œβ”€β”€ Audio/         (all voice conversations)
β”‚   └── DALLE/         (AI-generated images)
β”œβ”€β”€ Starred/
β”‚   └── 2025/
β”‚       β”œβ”€β”€ 01-January/
β”‚       └── 02-February/
β”œβ”€β”€ Archived/
β”‚   └── 2025/
β”‚       └── 01-January/
└── Regular/
    └── 2025/
        β”œβ”€β”€ 01-January/
        β”œβ”€β”€ 02-February/
        └── 03-March/

Other modes: See the Organization Guide for Flat, By Category, and By Date modes.

Media Embedding:

  • Images: ![Image](../../Assets/Images/file-ABC123.png)
  • Audio: <audio controls src="../../Assets/Audio/file_0000.wav"></audio> *Audio (11.3s)*

πŸ“ Example Output

---
title: "My Conversation About React"
created: 2025-01-15 14:30:00
updated: 2025-01-15 16:45:00
tags:
  - chatgpt
  - conversation
---

# My Conversation About React

<sub>01-15-2025</sub>

---

**User**:

Can you help me understand React hooks?

**ChatGPT**:

Of course! React hooks are functions that let you use state...

**User**:

![Image](Assets/file-ABC123-diagram.png)

Can you explain this diagram?

**ChatGPT (thinking)**:

> [!note] Internal Reasoning
> **Analyzing diagram**: The user has shared a component lifecycle diagram...

**ChatGPT**:

This diagram shows the React component lifecycle...

**User**:

<audio controls src="Assets/file_000000002be0.wav"></audio> *Audio (5.2s)*

**ChatGPT**:

Sure! I can hear your question about useState...

πŸ”§ Troubleshooting

Missing Images

  • Make sure you extracted ALL files from the ChatGPT export ZIP
  • Verify that file-* files and folders are in the JsonFiles directory
  • Check that paths in config.json are absolute paths (e.g., C:\Users\... on Windows)

Path Errors on Windows

  • Use double backslashes in paths: C:\\Users\\...
  • Or use forward slashes: C:/Users/...

Virtual Environment Issues

# Deactivate and recreate if needed
deactivate
rm -rf venv  # or rmdir /s venv on Windows
python -m venv venv
venv\Scripts\activate  # Windows
pip install tqdm

πŸ“₯ Importing to Your Note-Taking App

Obsidian (Recommended) ⭐

Perfect integration with all features:

  1. Extract the converted ZIP file
  2. Open your Obsidian vault folder in File Explorer/Finder
  3. Drag the MarkdownFiles folder into your vault
  4. Rename (optional): Change MarkdownFiles to "ChatGPT Conversations" or anything you want
  5. Refresh Obsidian: Press Ctrl+R (or Cmd+R on Mac)
  6. βœ… Done! Find conversations in the sidebar

What you get:

  • βœ… Searchable YAML frontmatter (title, dates, tags)
  • βœ… Collapsible thinking/reasoning sections
  • βœ… Embedded images and audio that work offline
  • βœ… All relative paths stay portable

⚠️ Important: Keep the Assets folder with your markdown files! Images/audio won't work if separated.


Notion

Good for sharing and collaboration:

  1. Extract the converted ZIP file
  2. Open Notion β†’ Create a new page or database
  3. Import Click β‹― menu β†’ Import β†’ Markdown
  4. Select all .md files from MarkdownFiles
  5. Upload the Assets folder separately
  6. βœ… Done! Conversations are now in Notion

Note: Some markdown formatting (like collapsible sections) may not transfer perfectly.


Logseq

For graph-based organization:

  1. Extract the converted ZIP file
  2. Open your Logseq graph folder
  3. Copy contents of MarkdownFiles into your pages folder
  4. Move Assets folder to your graph root
  5. Re-index your graph
  6. βœ… Done! Conversations appear in your graph

Other Markdown Editors (VS Code, Typora, MarkText, etc.)

Universal markdown compatibility:

  1. Extract the converted ZIP file
  2. Open MarkdownFiles folder in your editor
  3. βœ… Done! Browse and edit your conversations

πŸ’‘ Tip: The Assets folder contains all images and audio files


πŸ’‘ Pro Tips for Importing

  • βœ… Rename the MarkdownFiles folder to anything you want
  • ⚠️ Never separate the Assets folder from your markdown files
  • πŸ”— Portable paths: All image/audio links use relative paths
  • πŸ“Š Rich metadata: Each file has YAML frontmatter with title, dates, and tags
  • πŸ—‚οΈ Organization modes: Your chosen mode (Flat/Category/Date/Hybrid) determines the folder structure

πŸ“Š What Gets Converted?

βœ… Included:

  • All conversation text
  • Images and screenshots you uploaded
  • DALL-E generated images
  • Audio messages - Embedded with playable HTML5 audio controls
  • Tool calls and execution logs
  • ChatGPT's internal reasoning (if available)
  • User context and custom instructions
  • Code blocks with formatting

⚠️ Special Handling:

  • Video messages are shown as placeholders (audio track not currently extracted)
  • ChatGPT's web browsing results show content but not raw data

🀝 Contributing

This is a free and open-source project! Contributions are not just welcome - they're encouraged.

Ways to Contribute:

  • πŸ› Report bugs - Open an issue if something doesn't work
  • πŸ’‘ Suggest features - Tell us what would make this better
  • πŸ”§ Submit pull requests - Fix bugs, add features, improve docs
  • πŸ“– Improve documentation - Help others understand how to use this
  • ⭐ Star the repo - Show your support!

Pull Request Guidelines:

  1. Test your changes - Make sure both HTML and Python versions work
  2. Update README - Document new features
  3. Keep it simple - This tool is meant to be easy to use
  4. Follow existing patterns - Match the current code style

Not sure where to start? Check the Issues page for ideas or open a new discussion!

πŸ“„ License

This project is free and open source, available under the MIT License.

You can:

  • βœ… Use it for personal projects
  • βœ… Use it for commercial projects
  • βœ… Modify and distribute it
  • βœ… Build upon it

No attribution required (but appreciated!)

πŸ“ž Support & Questions

Need help?

Found a bug or have an idea? We'd love to hear from you! This project gets better with community input.

πŸ™ Acknowledgments

  • Created by daugaard47
  • Built with help from the community
  • Supports ChatGPT multimodal content and Obsidian optimization

⭐ Show Your Support

If this tool helped you preserve your ChatGPT conversations:

  • ⭐ Star this repo on GitHub
  • πŸ› Report bugs to help improve it
  • πŸ’‘ Share your ideas for new features
  • πŸ”§ Contribute code if you're a developer
  • πŸ“’ Tell others who might find it useful

Enjoy your beautifully formatted ChatGPT conversations! πŸŽ‰

Free, open source, and built for the community.

About

ChatGPT Conversations to Markdown is a Python script that converts your exported ChatGPT conversations into readable and well-formatted Markdown files.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published