Can You Paste a Whole Codebase into Gemini?
Only on some plans, and pasting isn't the best way. Use Add files > More Uploads > Import Code, which takes a folder or a GitHub URL, on Google AI Pro or Ultra. Their 1 million token window holds roughly 30,000 lines of code by Google's estimate. On Free or Plus, send only the files that matter.
I've imported the repo. It's a [language/framework] app that [does what]. Question: [one question that crosses files, e.g. "Trace what happens from the POST /orders handler to the database write, including every place the order total can change."] Answer as a numbered chain. For each step, give the file path, the function name and what it does. If you can't see a step in the code I gave you, say so instead of inferring it. List any folders you didn't read.
- 1Repo or folder per chat
- 5,000Files at most
- 100 MBTotal size at most
- 1Trim the folder
- 2Import Code
- 3Ask one cross-file question
- 4Open the cited files
Try it now
- 1Make a clean copy of the project without
node_modules, build output and data files, or use a GitHub branch URL. - 2In the chat box, click Add files, then More Uploads, then Import Code, and choose Upload folder or enter the URL.
- 3Paste the prompt above and click Submit. Watch for a warning that your uploads may be too large.
- 4Open three of the paths it cites. You'll know it worked when each function exists and does what Gemini said.
Use it when
Questions that cross files: tracing a request through the layers, finding every place a rule is enforced, planning a rename, or getting your bearings in a repo you've just joined.
Skip it when
When you already know the two files involved. Attach those, because a smaller input is quicker and uses less of your limit. Don't upload code you're not allowed to share either, and check Keep Activity first, since uploads are saved under it and can be reviewed.
Why it works
Some questions can't be answered from one file, such as "where does this value get changed?" or "what breaks if I remove this field?" With the code in context, Gemini can follow a chain across files, and you don't have to find them first. Google's API docs say providing all the relevant information up front is often better than relying on truncation, summaries or RAG. The limit is real, though: the help page says exceeding the window can cause answers to miss details spread through large files. Also, its message Your uploads may be too large for the best results is one to take seriously.
Example
Say your checkout total is sometimes one cent off. Import the repo, then ask Gemini to trace every place the total is calculated or rounded, from the cart to the receipt, with the file and function for each. That question is hard to ask from one file, because the point is that you don't know which files are involved. Once you have the list, take the two most suspicious functions into a new chat with a failing example.
Going further
Check the window before you trust the answer. Google says one code folder or repository is allowed per chat, with up to 5,000 files and 100 MB, but passing that limit doesn't mean the code fits the context window: 100 MB of text is far more than 1 million tokens at Google's estimate of about 4 characters per token. So a large repo can upload and still be only partly used. Import one service or package at a time if you can.
Common mistakes
- Treating a successful upload as proof that Gemini read everything. Ask it which folders it didn't read.
- Asking several questions in one prompt. Google's long context docs say accuracy drops with multiple things to find, compared with one.
- Leaving generated files in the upload. Lock files and bundles use up space without adding anything useful.
- Doing this in Deep Think on Ultra. Google gives it a 192 thousand token window, not 1 million.
Sources
- Upload and analyze files, Gemini Apps Help
- Gemini Apps limits and feature availability
- Long context, Gemini API docs
- Understand and count tokens, Gemini API docs
- Gemini Apps Privacy Hub
Checked 6 November 2026. Products change often, so confirm details with the vendor.