You're building a custom GPT, you've prepared your knowledge base files, and you hit a wall: the upload fails, or ChatGPT silently ignores half your content. The documentation on file limits is scattered across OpenAI's help center, changelogs, and community forums, and some of it is outdated. Here's what actually applies right now.
Current File Limits for Custom GPTs
As of early 2026, these are the hard limits for custom GPT knowledge base uploads:
| Limit | Value |
|-------|-------|
| Maximum files per GPT | 20 |
| Maximum file size (per file) | 512 MB |
| Maximum total knowledge base | ~2 million tokens (approximate) |
| Supported formats | .txt, .pdf, .docx, .csv, .json, .md, .pptx, .xlsx |
| Maximum retrieval context per query | ~8,000–16,000 tokens |
A few important details:
- The 20-file limit is a hard cap. You cannot add a 21st file regardless of size.
- The 512 MB per file limit rarely matters in practice — text-based files almost never get that large. The real constraint is tokens.
- The ~2 million token total is an approximate ceiling. OpenAI indexes your uploaded files into a vector store, and there's a practical limit on how much text gets indexed. If your combined files significantly exceed this, some content simply won't be retrievable.
- The retrieval window per query is the most important limit to understand. Even if you upload 2 million tokens, ChatGPT only retrieves a small portion (roughly 8,000–16,000 tokens) for any given user query. This is why chunking and organization matter so much — the retrieval system needs to find the right 8K–16K tokens out of your entire knowledge base.
What Happens When You Exceed the Limits
Knowing the limits is one thing. Understanding the failure modes is what saves you debugging time.
Too Many Files
If you try to upload a 21st file, the upload interface simply blocks it. Straightforward.
Files Too Large (Token-Wise)
This is where it gets subtle. A large file won't fail to upload — it'll upload fine. But OpenAI's indexing pipeline may not index all of it. Sections near the end of very large files are more likely to be missed during retrieval. You won't get an error message; your GPT will just fail to answer questions about content buried deep in oversized files.
Poor Retrieval from Large Knowledge Bases
The most common complaint is "my custom GPT ignores information I uploaded." This usually isn't a limit issue — it's a retrieval quality issue. When your knowledge base is large and unstructured, the vector search pulls in vaguely relevant chunks instead of the precise answer.
Signs this is happening:
- GPT gives generic answers instead of citing your documents
- GPT answers questions about some topics but not others (the ones with poor chunk quality)
- GPT contradicts information in your files because retrieved context is incomplete
Strategies for Working Within the Limits
1. Consolidate Smartly, Don't Just Concatenate
With only 20 file slots, you need to be strategic. Don't just dump everything into one massive file — that hurts retrieval. Instead, organize by topic:
customer-support-policies.txt (returns, refunds, shipping)
product-specifications.txt (specs, dimensions, compatibility)
onboarding-guide.txt (setup steps, getting started)
troubleshooting-faq.txt (common issues, error messages)
pricing-and-plans.txt (plan details, billing, upgrades)
Each file should cover a coherent topic area. This helps the retrieval system because file-level metadata (the filename) provides an additional signal.
2. Optimize Token Usage
Not all text in your documents needs to be in the knowledge base. Strip out:
- Table of contents — wastes tokens and confuses retrieval
- Copyright notices and legal boilerplate — unless your GPT needs to answer legal questions
- Repeated headers and footers — these get extracted from PDFs and waste tokens
- Redundant content — if the same FAQ appears in three documents, include it once
- Formatting artifacts — bullet point symbols, page numbers, decorative characters
A 100-page PDF might contain 50,000 tokens of text, but after removing noise, the meaningful content might be 30,000 tokens. That 40% reduction means you can fit more actual knowledge into your budget.
3. Front-Load Important Content
Because retrieval has a bias toward content that's well-structured and clearly labeled, put your most critical information in clearly-headed sections at the beginning of each file.
Good structure:
## Return Policy
Customers can return products within 30 days of purchase.
Full refund for unopened items. 15% restocking fee for opened items.
Contact support@example.com to initiate a return.
## Shipping Rates
Domestic standard: $5.99, 5-7 business days
Domestic express: $14.99, 2-3 business days
International: $24.99, 7-14 business daysBad structure:
As per our company guidelines established in 2019 and updated in
accordance with our customer satisfaction initiative (see memo #47
from Q3 2023), the following return procedures shall apply to all
merchandise purchased through authorized channels including but not
limited to our website, mobile application, and in-store purchases...
The first version is retrievable. The second version buries the answer in corporate language that wastes tokens.
4. Use Descriptive Filenames
Custom GPT retrieval uses filenames as context signals. doc_export_final_v2.txt tells the system nothing. product-return-policy-2026.txt tells it exactly what's inside.
5. Test Retrieval, Not Just Upload
After uploading your files, test with specific questions that should have clear answers in your knowledge base. If the GPT can't answer them, the issue is usually:
- The relevant content is buried in a large, unstructured chunk
- The content exists but isn't phrased in a way the retrieval system matches to the query
- The file format caused extraction issues (especially common with complex PDFs)
Token Counting: How to Check Before Uploading
Before you upload, estimate your token count to make sure you're within budget. OpenAI's tokenizer (based on cl100k_base for GPT-4) converts text to tokens at roughly this rate:
- English text: ~1 token per 4 characters, or ~750 tokens per 1,000 words
- Code: slightly higher token count due to syntax characters
- Structured data (JSON, CSV): varies widely based on formatting
You can use OpenAI's tokenizer tool or the tiktoken library:
import tiktoken
def count_tokens(text: str) -> int:
encoding = tiktoken.get_encoding("cl100k_base")
return len(encoding.encode(text))
# Example
with open("knowledge-base.txt") as f:
content = f.read()
tokens = count_tokens(content)
print(f"Token count: {tokens:,}")If your total across all files approaches 2 million tokens, start prioritizing. Cut the least-queried content first.
When to Split vs. Combine Files
Split when:
- A single source document covers multiple unrelated topics
- The document is longer than ~50,000 tokens
- Different sections have different update frequencies
Combine when:
- You're running up against the 20-file limit
- Multiple short documents cover the same topic area
- Related content is spread across many small files
The goal is 20 or fewer files, each covering a coherent topic, each under ~100,000 tokens (ideally much less), with clean formatting and descriptive filenames.
Automate the Optimization
Manually extracting text from PDFs, cleaning formatting, counting tokens, and organizing files is tedious — especially if you're iterating on your knowledge base as your custom GPT evolves.
Knowledge Builder Pro automates the entire pipeline. Upload your raw documents (PDF, DOCX, CSV, HTML, Markdown), and it extracts clean text, strips noise, chunks content by topic, and outputs optimized .txt files sized for custom GPT retrieval. It handles the formatting issues, token optimization, and file organization so you can focus on what your GPT actually does.
No more guessing whether your files are too large or poorly structured — the output is ready to upload directly to your custom GPT's knowledge base.