Don't particularly trust anything in this file. I didn't proofread what Claude wrote.
A tool to convert ChatGPT backup files (in JSON format) to Markdown files for easier reading and sharing.
- Converts ChatGPT conversations to readable Markdown files
- Maintains conversation structure and metadata
- Preserves timestamps (optional)
- Handles different message types (text, code, execution output)
- Copies DALL-E image files to the output directory
git clone https://github.com/yourusername/chatgpt_to_markdown.git
cd chatgpt_to_markdown
python chatgpt_to_markdown.py /path/to/openai-export-dir# Install from the cloned repository
git clone https://github.com/yourusername/chatgpt_to_markdown.git
cd chatgpt_to_markdown
pip install .
# Now you can use it from anywhere
chatgpt_to_markdown /path/to/openai-export-dirpython chatgpt_to_markdown.py /path/to/openai-export-dir [output_dir]/path/to/openai-export-dir: Path to the directory containing the OpenAI data export (should contain a conversations.json file)output_dir: (Optional) Output directory for the Markdown files. If not specified, defaults totmp_md_<export-dir-name>
python chatgpt_to_markdown.py ~/Downloads/openai-2025-04-06This will create a directory called tmp_md_openai-2025-04-06 containing all the conversations as Markdown files.
Each conversation is saved as a separate Markdown file with the following format:
# Conversation Title
Created: 2025-04-06 14:30:45
Last Updated: 2025-04-06 15:20:12
### User - 2025-04-06 14:30:45
User message text here...
### Assistant - 2025-04-06 14:31:10
Assistant response here...
### Tool (python) - 2025-04-06 14:32:05
```python
print("Hello, world!")Hello, world!
## Background
This tool was created to make ChatGPT conversation exports more accessible and easier to browse. The OpenAI export format can be difficult to navigate with its nested JSON structure, so this tool flattens each conversation into a readable Markdown file.
## Requirements
- Python 3.6+
- No external dependencies
## License
MIT