AI & Agents

ChatGPT Code Interpreter File Size Limit: Upload Caps and Sandbox Workarounds

While ChatGPT Code Interpreter permits raw file uploads up to 512MB per file, the sandboxed Python execution container enforces strict memory boundaries (typically 512MB to 1GB of RAM), meaning datasets that upload without error can still crash the session during dataframe parsing or memory-intensive calculations. Distinguishing transport limits from execution caps enables teams to optimize column types, stream data in chunks, and decouple large persistent files from ephemeral chat sessions.

Derek Labian 20 min read Updated

What Is the ChatGPT Code Interpreter File Size Limit?

According to OpenAI file upload documentation, while ChatGPT Code Interpreter permits raw file uploads up to 512MB per file, the sandboxed Python execution container enforces strict memory boundaries (typically 512MB to 1GB of RAM), meaning datasets that upload without error can still crash the session during dataframe parsing or memory-intensive calculations.

When data engineers, analysts, and developers upload files into ChatGPT, they interact with two completely different systems: the file ingestion transport layer and the isolated code execution container. Understanding how these two layers differ is essential for avoiding unhandled kernel terminations.

The Ingestion Transport Layer

The headline ChatGPT Code Interpreter upload limit of 512MB per file can be misleading for data analysts, because raw ingestion capacity does not guarantee that the runtime sandbox can execute code against the data. Whether evaluated under the original plugin moniker or as the ChatGPT Advanced Data Analysis file size limit, OpenAI enforces specific file size ceilings according to document classification at the transport boundary:

  • General Documents and Raw Binaries: Files such as PDFs, Word documents, presentation decks, and compressed archives can be uploaded up to 512MB per individual file.
  • Spreadsheets and Delimited Data: Tabular files, including CSV, TSV, and Excel spreadsheets (.xlsx, .xls), face a separate threshold of approximately 50MB per file, depending on row dimensions and formatting.
  • Text and Document Token Ceilings: Text-based document files carry a secondary restriction of 2 million tokens per file. Spreadsheets are exempt from this token ceiling, but they remain bounded by the 50MB file size limit.
  • Images and Visual Assets: Visual files uploaded for multimodal inspection route through a dedicated vision ingestion pipeline rather than general file storage.
  • Account Transfer Quotas: OpenAI enforces rolling upload caps per account across rolling three-hour windows, restricting high-frequency batch analysis.

Because the browser interface displays a clean progress bar and registers a successful upload for large files, users assume the compute environment is prepared to manipulate the entire payload. In reality, the transport layer deposits the file onto the container virtual disk at /mnt/data/. The actual bottleneck begins when Python attempts to read those bytes into active memory.

Compute Sandbox Execution Boundaries

The compute layer operates inside an isolated, containerized Linux microVM running a Jupyter kernel. Unlike standard development machines or cloud data science instances equipped with dozens of gigabytes of RAM, OpenAI execution containers allocate minimal system resources to each chat session:

  • System Memory (RAM): The execution sandbox is constrained by Linux control groups (cgroups), generally restricting memory consumption to between 512MB and 1GB. In the OpenAI API, the default memory allocation for the code_interpreter container object is documented at 1GB, with optional container tiers for larger workloads.
  • Session Lifespan and Idle Timeouts: The sandbox is entirely ephemeral. Containers expire after 20 minutes of user inactivity. Chat sessions also enforce an overall session timeout (typically 60 minutes), after which the container is recycled and all files stored in /mnt/data/ are deleted.
  • Network Isolation: The container has zero inbound or outbound internet access. It cannot download missing Python wheels from PyPI, query external REST APIs, connect to external databases, or fetch remote datasets.
  • Compute Architecture: The container runs on virtualized x86_64 CPU cores with no GPU acceleration. Calculations that exceed execution limits are terminated by server-side timeouts.

The following comparison table details the documented limits, runtime constraints, and common failure modes across primary data formats:

File Format / Interface Transport Upload Limit Sandbox Execution Limit Primary Failure Mode Verified Reference
Documents (.pdf, .docx, .txt) 512MB per file 2M tokens context limit Token truncation during retrieval OpenAI Help Center (2026)
Spreadsheets (.csv, .xlsx) ~50MB per file 512MB to 1GB container RAM Kernel OOM crash on dataframe load OpenAI File Uploads FAQ (2026)
Binary Archives (.zip, .tar.gz) 512MB per file Ephemeral disk / RAM limits Disk fill or memory exhaustion OpenAI Help Center (2026)
Visual Assets (.png, .jpeg) 20MB per file Downscaled / 1,445 tokens max Vision downscaling or prompt token bloat OpenAI Vision Documentation (2026)
API Container (code_interpreter) 512MB per file 1GB default (configurable to 64GB) Inactivity timeout after 20 minutes idle OpenAI API Reference (2026)

Why Large CSV Files Trigger Out of Memory Kernel Crashes

The primary point of confusion for ChatGPT users is the sudden collapse of Python sessions when loading CSV files that upload without complaint, such as a dense tabular export. The upload succeeds, but the first prompt that calls pd.read_csv() triggers an abrupt kernel reset.

This failure is not caused by a software defect in ChatGPT. It is the mathematical consequence of how Python and the pandas library allocate memory for tabular structures inside a resource-constrained container.

How Pandas Expands Tabular Data in Memory

A CSV file stored on disk is dense, unparsed text. A cell containing the string California takes 10 bytes in a UTF-8 encoded text file. However, when pandas parses that CSV into memory, it converts raw bytes into high-overhead Python objects:

  1. Python String Overhead: Python does not store strings in contiguous memory blocks. Each string in a standard pandas object column is an instantiated PyUnicodeObject. On a 64-bit operating system, a PyUnicodeObject carries substantial base object metadata (type pointers, reference counters, hash caches, and encoding flags). In addition, pandas creates an array of 8-byte pointers pointing to those objects. Consequently, a short text entry consumes substantially more RAM inside the container than on disk.
  2. Default Numeric Typing: When parsing unformatted numbers, pandas defaults to 64-bit allocations (int64 or float64). A column of small integers requires 8 bytes per cell in pandas, even though the raw text only occupied 1 to 3 bytes on disk.
  3. Parsing Buffers and Intermediate Copies: The pd.read_csv() parser does not stream directly into the final array layout. It reads raw byte chunks into intermediate C buffers, tokenizes fields into string lists, builds intermediate column blocks, and finally constructs the DataFrame index. During this ingestion step, the process requires substantial additional working memory to complete the conversion.

When pandas ingests a large CSV containing dozens of columns and hundreds of thousands of rows of transaction data (names, dates, categories, and dollar amounts), the in-memory footprint expands dramatically. Factoring in intermediate allocation buffers during parsing, peak memory demand during pd.read_csv() easily exceeds available sandbox RAM.

Linux Control Groups and the Kernel OOM Killer

OpenAI manages container security and multi-tenant resource fairness using Linux control groups (cgroups v2). In the standard ChatGPT interface, the ChatGPT Code Interpreter memory limit assigned to the container is capped between 512MB and 1GB.

When pandas demands more memory than the container allows during CSV ingestion, the container process hits the cgroup memory.max boundary. Because the container has no active swap space configured, the Linux kernel has only one recourse: the Out-of-Memory (OOM) killer.

The kernel identifies the process consuming the largest resident set size (RSS), which is invariably the Python kernel process (python3 -m ipykernel_launcher), and sends an uncatchable SIGKILL (signal 9). This sudden shutdown triggers an unrecoverable ChatGPT out of memory error Code Interpreter session termination that wipes all active variables.

From the user perspective, this results in three characteristic symptoms:

  • Immediate Kernel Termination: The ChatGPT UI displays a generic error message, such as "An error occurred while executing the code" or "The Python kernel died unexpectedly. A new kernel has been started."
  • Total State Erasure: Because the operating system terminated the kernel process, all previously computed variables, loaded tables, and imported libraries vanish from memory.
  • Failed Recovery Prompts: ChatGPT frequently fails to recognize that the container reset. When asked to continue, the model writes subsequent code referencing dataframes that no longer exist, producing NameError: name 'df' is not defined.

Ephemeral Storage and Inactivity Resets

Beyond memory-induced crashes, data analysts frequently encounter the sandbox lifecycle boundaries. The storage directory provided at /mnt/data/ is backed by ephemeral container storage, not persistent block volumes.

As documented by OpenAI, containers expire after 20 minutes of user inactivity. If an analyst uploads a dataset, pauses during exploration, and submits subsequent queries after twenty minutes of inactivity, the original container has already been destroyed. A fresh container is spun up in its place with an empty /mnt/data/ directory, causing subsequent analysis commands to fail with FileNotFoundError.

Similarly, long-running analyses that generate intermediate summary files or exported charts will lose those artifacts once the session ceiling is reached. Any file generated inside the sandbox must be downloaded immediately via a generated download link, or it is lost permanently.

How to Process Large Datasets in the ChatGPT Python Sandbox

When your dataset cannot be split or moved to external infrastructure, you can prevent container OOM crashes by forcing the Code Interpreter to execute memory-conscious Python patterns. Rather than letting ChatGPT execute default pd.read_csv() commands, explicitly instruct the model to adopt the following four optimization strategies.

1. Stream and Aggregate with Chunked CSV Parsing

The most reliable method for analyzing larger tabular files is chunked iteration. By passing the chunksize parameter to pd.read_csv(), Python loads a fixed number of rows into memory at a time, computes running aggregates, and discards the raw rows before loading the next block.

Instruct ChatGPT with a prompt like: "Do not load the entire CSV into memory. Read the file in chunks of 10,000 rows, compute summary aggregates on each chunk, and combine the summaries."

import pandas as pd

### process data in 10,000-row chunks to cap memory footprint
chunk_size = 10000
aggregated_chunks = []

for chunk in pd.read_csv('transaction_logs.csv', chunksize=chunk_size):
    ### filter unnecessary rows early
    valid_rows = chunk[chunk['status'] == 'completed']
    
    ### calculate group summaries on the current chunk
    summary = valid_rows.groupby('region')['revenue'].agg(['count', 'sum'])
    aggregated_chunks.append(summary)

### consolidate intermediate chunk summaries into a final result
final_report = pd.concat(aggregated_chunks).groupby(level=0).sum()
final_report['average_revenue'] = final_report['sum'] / final_report['count']
print(final_report)

By processing in batches, total resident memory never exceeds the footprint of a single chunk, completely avoiding container memory exhaustion.

2. Specify Column Subsets and Downcast Primitive Types

Datasets often contain columns that are irrelevant to your immediate query, such as descriptive text, internal identifiers, or verbose metadata. Loading these unused fields wastes container memory.

Direct ChatGPT to load only the required columns using usecols, and explicitly cast numeric and string fields to smaller primitive types:

  • Convert default 64-bit floats (float64) to 32-bit floats (float32), cutting numeric column memory consumption in half.
  • Convert 64-bit integers (int64) to 16-bit or 32-bit integers (int16, int32).
  • Convert repetitive text columns (such as states, countries, status flags, and product categories) to the pandas category dtype. This stores unique strings once in a lookup table and replaces redundant values with lightweight integer keys.
import pandas as pd

### explicitly declare memory-optimized column types
optimized_dtypes = {
    'user_id': 'int32',
    'region': 'category',
    'payment_method': 'category',
    'amount': 'float32'
}

required_columns = ['user_id', 'region', 'payment_method', 'amount']

df = pd.read_csv(
    'large_dataset.csv',
    usecols=required_columns,
    dtype=optimized_dtypes
)

print(f"Loaded {len(df):,} rows successfully")

3. Convert Tabular Data to SQLite Before Upload

For datasets that require complex relational joins or ad-hoc slicing, converting the data into an indexed SQLite database (.sqlite or .db) on your local machine before uploading is far more effective than uploading flat CSVs.

Because SQLite files are binary databases, they upload under the general 512MB binary cap rather than the 50MB spreadsheet threshold. More importantly, Python's built-in sqlite3 module queries database files directly from disk without reading the entire file into RAM.

import sqlite3
import pandas as pd

### connect to the uploaded SQLite database file
connection = sqlite3.connect('sales_archive.db')

### run SQL queries that execute on disk, pulling only the final result into pandas
query = """
SELECT 
    region,
    product_category,
    COUNT(*) as total_orders,
    ROUND(SUM(sale_amount), 2) as total_volume
FROM orders
WHERE order_date >= '2026-01-01'
GROUP BY region, product_category
ORDER BY total_volume DESC
LIMIT 25;
"""

result_df = pd.read_sql_query(query, connection)
connection.close()

print(result_df)

Using this pattern, you can upload an indexed SQLite database containing dense relational tables, execute SQL queries inside the sandbox in fractions of a second, and maintain a minimal Python memory footprint.

4. Archive Compression and Gzip Streaming

If you must upload large text corpora, logs, or raw JSON structures, compress them into .zip or .gz archives before uploading. A verbose JSON export frequently compresses to a fraction of its uncompressed size on disk.

Python inside Code Interpreter natively handles decompression using the gzip and zipfile standard libraries. However, avoid extracting the entire archive onto the /mnt/data/ disk, which can trigger disk space exhaustion. Instead, stream the archive line by line:

import gzip
import json

record_count = 0
total_value = 0.0

### stream compressed data without decompressing the full archive to disk
with gzip.open('system_logs.json.gz', 'rt', encoding='utf-8') as f:
    for line in f:
        record = json.loads(line)
        if record.get('event_type') == 'purchase':
            record_count += 1
            total_value += record.get('payload', {}).get('price', 0.0)

print(f"Processed {record_count:,} purchases. Total value: {total_value:,.2f}")
Fastio features

Stop Crashing AI Sandboxes with Raw File Attachments

Store large datasets in a persistent Fastio workspace and query indexed files directly from ChatGPT with semantic search. Monthly plans start with a 14-day free trial.

When to Decouple Persistent Storage From Ephemeral AI Sandboxes

While chunking and SQLite workarounds help resolve immediate memory crashes, attaching raw data files to chat conversations remains an inefficient architecture for production teams.

Chat-based file analysis suffers from structural constraints that technical workarounds cannot fix:

  • Isolated Ephemeral Silos: Every chat conversation is an isolated sandbox. Datasets uploaded to one chat thread are inaccessible to other team members, other conversations, or other AI agents.
  • Repetitive Upload Overhead: If several team members analyze the same dataset across separate conversations, each must upload duplicate copies independently, consuming bandwidth and drawing down rolling upload quotas.
  • Zero Cross-File Intelligence: The Code Interpreter sandbox cannot search across hundreds of supporting documents, related spreadsheets, and context notes simultaneously. It analyzes only the exact files uploaded to that specific conversation.
  • Volatile State Retention: Once a chat session expires or resets after 20 minutes of user inactivity, all loaded dataframes, generated scripts, and intermediate outputs disappear.

Data teams require an architecture that decouples persistent corpus storage and indexing from the ephemeral execution layer where models reason.

Comparing Storage and Persistence Options

Organizations addressing this challenge evaluate three primary architectural patterns:

  • Raw Object Storage (AWS S3, Google Cloud Storage): Object storage accommodates massive files. However, raw object stores are passive bit buckets. They lack automatic document parsing, offer no native semantic search, require custom IAM permission plumbing, and provide no collaboration workspace for non-technical team members.
  • Traditional Cloud Sync Providers (Google Drive, Dropbox, Box): Consumer cloud drives simplify human file sharing, but they are ill-suited for automated agent operations. They enforce strict API rate limits, lack built-in document data extraction, and do not provide an agent-native protocol for conversational querying.
  • Intelligent Workspaces (Fastio workspaces): An intelligent workspace provides persistent, team-wide file storage where files are automatically indexed for AI retrieval and accessible to both humans and autonomous agents through standard protocols.

The Persistent Intelligent Workspace Architecture

Fastio provides a dedicated cloud workspace platform designed for agentic teams, bridging persistent storage with conversational AI tools:

  1. Massive File Capacity Without In-Chat Uploads: Rather than squeezing large datasets through chat attachment limits, files are stored permanently in shared, organization-owned workspaces. Workspaces accommodate multi-gigabyte files without browser upload timeouts.
  2. Built-in Intelligence Mode: When Intelligence Mode is enabled on a workspace, files are automatically indexed for hybrid search, combining full-text search, semantic search, and metadata value filtering. Instead of forcing an AI model to ingest an entire document collection into active memory, the assistant searches the indexed corpus and retrieves only the exact passages or records needed to answer the question. Check storage for agents for architectural patterns.
  3. Structured Document Extraction with Metadata Views: Unstructured documents (PDF reports, scanned receipts, financial statements, and contracts) can be transformed into a queryable, structured database using Metadata Views. Users define target fields in natural language, and AI populates a typed, filterable view with text, integer, decimal, boolean, JSON, and timestamp columns without manual parsing scripts.
  4. Native Model Context Protocol (MCP) Integration: Agents connect to Fastio workspaces over Streamable HTTP without managing local file synchronization. ChatGPT users can install the Fastio plugin directly from the ChatGPT plugin directory (chatgpt.com/plugins). Alternatively, workspaces can connect through a custom MCP server at https://mcp.fast.io/mcp/operations (with setup documentation available at Fastio MCP setup documentation). Coding agents in CLI or IDE environments connect at https://mcp.fast.io/mcp/code, while Claude desktop and web connectors use https://mcp.fast.io/mcp/tools. For autonomous developer workflows, review the agent developer reference.
  5. Team-Wide Cloud Sync and Auditability: Workspaces can synchronize with existing repositories using Cloud Sync, connecting Google Drive, Dropbox, Box, and OneDrive on a schedule or on demand. Every file retains comprehensive per-file version history, and a detailed activity log tracks modifications (such as uploads, edits, moves, deletions, and permissions) across human team members and AI agents alike.
  6. Transparent Subscription Pricing: Fastio offers three tiers: Starter, Business, and Enterprise, with monthly plans starting with a 14-day free trial that requires a credit card. Check Fastio pricing for complete plan details.

The following table summarizes Fastio plan capacities, upload ceilings, and included resources:

Plan Tier Monthly Billing Max Upload Size Included Seats Included Storage Workspaces Monthly AI Credits
Starter $9.99/mo 25 GB 3 seats 250 GB 5 100,000
Business $49.99/mo 50 GB 10 seats 5 TB 50 600,000
Enterprise $199.99/mo 100 GB 30 seats included 25 TB 200 3,000,000

Compare File and Memory Boundaries Across Leading AI Assistants

Choosing the right approach depends on understanding the file limits and runtime constraints across different AI platforms. Each leading assistant enforces distinct boundaries on upload sizes, container memory, and context capacity.

Platform Boundary Comparison

The following table summarizes file and execution boundaries across major AI environments:

Feature / Metric ChatGPT Code Interpreter Claude Projects & Chat Google Gemini Advanced Fastio Intelligent Workspace
Max Upload Size (Per File) 512MB (50MB for CSVs) 500MB (Chat) / 30MB (Projects) Up to 2GB via Google Drive 25 GB (Starter) to 100 GB (Enterprise)
Execution Environment Sandboxed Python (Jupyter) Server-side Artifacts / Analysis Python runtime in cloud Remote MCP / API Search & Extraction
Container Memory (RAM) 512MB to 1GB RAM Ephemeral container Ephemeral container Scalable cloud indexing & retrieval
Session Persistence Resets after 20m idle / 60m total Persists across Project chats Retained in Google account Permanent org storage & versioning
Native Search & Indexing None (in-memory parse only) Context window RAG Google Drive / 2M token context Hybrid search + Metadata Views
Multi-Agent / Team Sharing Single-user chat thread Shared Project members Shared Drive folders Multi-agent workspaces + MCP access

Anthropic Claude Mechanics

For teams using Anthropic Claude, file handling operates on a different architectural model. According to the Anthropic Claude upload documentation, a standard chat accepts up to 20 files at up to 500MB each, while a project accepts files up to 30MB each with an unlimited file count bounded strictly by Claude context window capacity.

The practical ceiling on a Claude Project is not an arbitrary file-count cap, but Claude's context window. When a project's attached files fill the available context window, the model cannot ingest further reference material. To overcome this context ceiling, teams connect Claude to Fastio using the remote MCP connector at https://mcp.fast.io/mcp/tools. This setup allows Claude to search through gigabytes of indexed documents on demand rather than attaching entire corpora to the conversation context.

Selecting the Right Operating Pattern

To select the most efficient architecture for your analytical workload, apply the following decision criteria:

  • Use In-Chat Code Interpreter When: Your data file is small enough to fit within standard spreadsheet limits, your analysis is an ad-hoc exploratory task, you require instant charting and statistical summaries, and the output is intended for immediate review.
  • Use Local Chunking or Python Scripts When: Your data exceeds default memory thresholds, you need to run one-off aggregations inside ChatGPT without external infrastructure, and you instruct the model to use explicit chunking and downcasted datatypes.
  • Use an Intelligent Workspace When: Your dataset exceeds chat attachment boundaries, your corpus contains hundreds of mixed documents and spreadsheets, several team members or automated agents need to query the same data, or you require persistent structured extraction without risking container resets.

Sources

References used to verify factual claims in this guide.

  1. OpenAI documentation specifies that ChatGPT file uploads enforce a 512MB limit per file, while spreadsheets and CSV files are capped at roughly 50MB and text documents face a 2 million token ceiling.

  2. OpenAI Code Interpreter provides a sandboxed Python execution container with over 330 packages, but enforces strict limits including no internet access and session state resets.

Frequently Asked Questions

What is the file size limit for ChatGPT Code Interpreter?

ChatGPT Code Interpreter enforces a maximum upload size of 512MB per file for general documents, presentations, and binary archives. However, spreadsheets and CSV files are constrained to approximately 50MB depending on row length, while images are capped at 20MB. In addition, text documents face a 2 million token ceiling per file.

Why does ChatGPT Code Interpreter crash on large CSV files?

When pandas loads a CSV using pd.read_csv(), raw strings and numbers expand substantially in memory due to Python object wrappers, pointer overhead, and temporary parsing buffers. A dense CSV file can require more memory than the container's 512MB to 1GB RAM limit allows. This triggers the Linux kernel out-of-memory killer, terminating the session.

How much RAM does ChatGPT Code Interpreter have?

The ChatGPT web sandbox typically allocates between 512MB and 1GB of container memory governed by Linux control groups. In the OpenAI API, the default memory allocation for the code_interpreter container object is documented at 1GB, with higher memory tiers available for programmatic workloads.

How do you process files larger than 512MB in ChatGPT?

To analyze datasets that exceed the standard 512MB file upload limit in ChatGPT, you can split files into smaller batches, stream chunks locally, or convert data into compact formats like SQLite. For recurring team workflows, teams store large corpora in a persistent cloud workspace like Fastio and connect ChatGPT via the Fastio plugin or MCP server to search and extract data without attaching raw files.

How long do uploaded files stay in a ChatGPT Code Interpreter session?

Files stored in the Code Interpreter environment at /mnt/data/ are ephemeral. The execution container expires after 20 minutes of user inactivity, and chat sessions face an overall reset after roughly 60 minutes. Once reset, all uploaded files and in-memory variables are permanently deleted.

Can ChatGPT Code Interpreter install external Python packages from PyPI?

No. ChatGPT Code Interpreter operates in a sandboxed container with no outbound internet access, meaning commands like pip install fail. The environment comes pre-installed with over 300 common data science and analysis libraries, including NumPy, pandas, Matplotlib, SciPy, and OpenCV.

Related Resources

Fastio features

Stop Crashing AI Sandboxes with Raw File Attachments

Store large datasets in a persistent Fastio workspace and query indexed files directly from ChatGPT with semantic search. Monthly plans start with a 14-day free trial.