Claude/Code/How To/Export Conversation to File
How To Export Claude/Code Conversations to Files
Overview
- This guide shows you how to save Claude Code conversation history to files for backup, sharing, or documentation purposes.
- Note: Claude Code does not have a built-in export feature that I could find as of 2025-07-18 Fri, so these are manual workarounds.
- For users who want to preserve conversation context, share discussions with team members, or maintain records of coding sessions.
Prerequisites
Methods and Workarounds
Manual Copy-Paste Method
Community Extractor Tools
- Claude Code keeps every prompt/response pair in plain-text JSONL files under
~/.claude/projects/<project-id>/transcript.jsonl - Finding Session IDs:
- From within an active session:
- Use Claude Code's built-in session picker:
- Run
claude --resumeto see an interactive list of all sessions - The picker shows: Modified date, Created date, Message count, and Description
- Example output:
Modified Created # Messages Git Branch Summary ❯ 1. 1m ago 1h ago 111 mn/PD-30064_Cr This session is being continued from a previo... 2. 1 week ago 1 week ago 427 - FastAPI Service Template with JSON Logging Setup - Use arrow keys to navigate and press Enter to select a session
- The session ID is the UUID in the project directory path
- Run
- Alternative: List project directories:
- Pro tip: Use
claude --resumeto see human-readable descriptions, then match them to the UUID directories
- Claude Conversation Extractor – CLI tool that converts JSONL transcripts to clean Markdown
- claude-code-log – Converts JSONL transcripts to minimalist HTML
- claude-transcript – Simple Markdown converter for Claude Code sessions
- Install from GitHub:
pip install git+https://github.com/jflam/claude-transcript.git - Usage:
claude-transcript <session-id>to convert to Markdown - Lightweight tool focused on clean Markdown output
- Works with the same JSONL transcript files as other tools
- GitHub
- Install from GitHub:
- Claude Code keeps every prompt/response pair in plain-text JSONL files under
Session Recording Methods
- Linux/script/command records the full interactive session to a log file
- bash
script -f claude_$(date +%F).log claude code - You can replay it with Linux/script/command/scriptreplay
scriptreplaylater - Red Hat Documentation
- LFCS Certification eBook
- tee command for read-only output (simple but loses your keystrokes)
- asciinema for shareable demos
- bash
asciinema rec -c "claude code" - Captures keystrokes and timing in a lightweight *.cast file you can embed on the web
- asciinema.org
- asciinema docs
- Linux/script/command records the full interactive session to a log file
MCP/Server/Filesystem Method
Browser & GUI Options
- Web version (claude.ai) has an official export feature
- Settings → Privacy → Export data button
- Emails you a zip containing chat JSON plus CSV
- Anthropic Help Center
- Claude Exporter Chrome extension
- Free Chrome extension that saves any web chat to PDF, Markdown, text, CSV, or JSON with one click
- Handy if teammates use the browser UI rather than Claude Code
- Chrome Web Store
- Web version (claude.ai) has an official export feature
Version Control Method
Workflow Recommendations
Troubleshooting
- File permissions: Check write permissions in target directory
- Large conversations: Consider breaking into smaller files for better manageability
- MCP server not working: Ensure the filesystem server is properly configured and connected
- Extractor tools not working: Verify the transcript files exist in
~/.claude/projects/<project-id>/transcript.jsonl
Related