How to Save Claude Chat History? Web Export + Claude Code Local Backup, Done in Two Steps
Claude's data export works along two paths:
- Claude.ai web version: Settings → Privacy → Export Data, and Anthropic will send a ZIP to your registered email.
- Claude Code: type
/exportin the terminal to export the current session, then add the~/.claudedirectory to your backup plan.
Let's go through the steps, including a detailed breakdown of the .claude directory structure and common pitfalls.
# Table of Contents (click to jump)
- 1. Exporting Chat History on Claude.ai Web
- 2. Saving Sessions Locally in Claude Code
- 3. Three Good Habits
- 4. Common Questions
- Conclusion
# 1. Exporting Chat History on Claude.ai Web
Claude.ai officially provides the simplest data export feature — it's the go-to method for backing up web chat history.
# Step-by-Step (Super Detailed)
- Open claude.ai (opens new window) and click your avatar in the bottom-left corner.
- Go to Settings → switch to the Privacy tab.
- Find the Export Data button and click it.
- Select the export time range (we recommend "All" or the last few months).
- After submitting, Claude will send the download link to your registered email.
What you'll receive after exporting:
- A ZIP archive
- Containing JSON-format conversation data (easy to search and process with AI)
- Account-related information
Tip: we recommend exporting regularly every 1-2 months, especially for heavy users.


# 2. Saving Sessions Locally in Claude Code
Claude Code stores all its data locally and doesn't depend on the cloud. This means that as long as your hard drive doesn't fail, your records won't be lost — and that's the biggest difference from the web version.
# 1. Quickly Export the Current Session: /export
In the Claude Code conversation window, type:
/export
Or specify a filename:
/export 项目名称-20260723.txt
The exported file is plain text and contains the complete conversation record of the current session. You can open and search it directly with Notepad, VS Code, or Typora.

# 2. Understanding the .claude Directory Structure (Know What You're Backing Up)
Running only /export isn't enough — it only exports the current single session. To protect all historical records and project context, you need to back up the entire .claude directory.
First, let's see what's actually inside. Open a terminal:
Mac / Linux:
ls -la ~/.claude/
ls -la ~/.claude/projects/
Windows (CMD):
dir "%USERPROFILE%\.claude" /a

Then enter the projects subdirectory:
dir "%USERPROFILE%\.claude\projects" /a

Directory structure description (based on the actual directory; versions may differ slightly):
| Path | What it is | Should you back it up |
|---|---|---|
.claude/projects/ | Session history and context memory for each project | ✅ Must back up |
.claude/settings.json | User configuration and preferences | ✅ Recommended |
.claude/credentials.json | Login credentials | ⚠️ Optional, but don't share it |
.claude/todos/ | Task records | As needed |
.claude/session-env/ | Session environment variables | As needed |
| Other cache and temp files | Runtime cache | ❌ Not needed |
Understand the difference between three concepts:
/export→ exports the current single session as a plain-text file, easy to read and share- Backing up
.claude/projects/→ preserves session history and context for all projects, in Claude Code's native format - Backing up the entire
.claude/→ includes config and credentials, for a full restore on another computer
# 3. How to Back Up
- Copy the entire
.claudefolder to a cloud drive (OneDrive, Google Drive, 坚果云). - For important projects, you can package
.claude/projects/你的项目名separately and archive it as a compressed file. - Windows users are advised to write a scheduled script that automatically copies to a backup directory every week.
# 3. Three Good Habits
- File naming convention:
project-name-date-topic.txt, e.g.,gptplus-20260724-chat-history-backup-plan.md. Three months later you'll still recognize what it is at a glance. - Double backup: one copy on your local hard drive + one in the cloud (OneDrive / Google Drive / 坚果云).
- Run it regularly: heavy users export Claude.ai data every 1-2 months, and the
.claudedirectory can be backed up automatically every week.
# 4. Common Questions
# What format is inside the ZIP exported by Claude.ai?
JSON format. After extracting, each conversation is a JSON file containing the complete conversation history, timestamps, and role markers (human / assistant). You can open it with any text editor, or write scripts to batch-parse it or import it into tools like Notion or Obsidian.
Note: currently Claude.ai does not support re-importing the exported JSON to restore the system — the purpose of export is offline archiving and knowledge organization, not migration.
# What's the difference between /export and backing up the .claude directory?
/export | Backing up .claude | |
|---|---|---|
| Scope | Only the current single session | All historical sessions + project context + config |
| Format | Plain text, directly readable | Claude Code internal format |
| Can it be restored to Claude Code | No (plain text) | Yes, just copy it back |
| Best for | Saving an important conversation, sharing with colleagues | Migrating to a new computer, preventing loss |
They complement each other — it's not an either/or choice.
# What if the exported file is too large?
In the official export ZIP, each conversation is one JSON file; you can split them up by date or topic for storage. There's no need to open everything at once — just write a script to search on demand.
# Are screenshots enough?
No. Screenshots can't be searched by keyword — finding one sentence among hundreds of images is basically impossible. Both JSON and plain text support full-text search; that's what a real backup looks like.
# What restrictions do Team / Enterprise users have?
Enterprise versions may require an admin to enable the Export Data permission, and some enterprises disable export outright for compliance reasons. If you're not sure, just ask your admin.
# Conclusion
Use Export Data for the web version, and /export + backing up the .claude directory for Claude Code. Both operations take less than five minutes, but they ensure your prompts and project context never get lost.
