Code to LLM Converter
.gitignore, skips node_modules. Everything runs in your browser; nothing is uploaded.Codebase
Drop a folder or files here
Or use the buttons below — nothing is uploaded
Sample output
Sample output — a two-file toy project. Drop your own folder to replace it.
Files
2
selected
Size
128 Bytes
selected files
Tokens
73
estimate, ~4 chars/token
Best for Claude & Cursor
Cost by model— show— hide
| Model | Context | Input cost |
|---|---|---|
| Claude Sonnet 5 | 1,000,000 | $0.000146₹0.0122 |
| GPT-4o | 128,000 | $0.000182₹0.0152 |
| GPT-5.6 Luna | 1,050,000 | $0.000015₹0.001219 |
Input-token pricing for this run, from the same model table the Token Counter uses. Approximate — verified against each provider's official pricing page as of August 31, 2026. Providers change prices without notice; check their page before a billing decision.
What is Code to LLM conversion?
A large language model has no filesystem to browse — it only sees whatever text is in the context window. To let it reason about a real project, every relevant file has to become part of one prompt, and the model needs to know how those files relate to each other, which is what a file tree at the top does. Pasting files one at a time loses that structure and burns the conversation's context on back-and-forth; Code to LLM builds the whole thing — tree plus every selected file, clearly separated — in one pass.
How we convert a codebase for LLMs
| Input | What we do | LLM-ready output |
|---|---|---|
| Folder, 50+ files | Respect .gitignore, exclude node_modules, build the file tree, count tokens | File tree + <file path> blocks |
| GitHub URL | Fetch the repo's file list and raw content via GitHub's public API/CDN | Same as a dropped folder |
| Pasted code | Detect language from the filename you give it | ```lang fenced block |
Code-to-LLM workflow
- STEP 1DropFolder, GitHub URL, or pasted code — read in your browser
- STEP 2Selectgitignore-aware file tree, checkboxes, select by extension
- STEP 3CopyPick XML, Markdown, Repopack, or Plain — paste into your LLM
Best practices for feeding code to an LLM
- Always include the file tree first — a model reasons much better about "where does this function live" when it has already seen the shape of the project.
- XML for Claude, Markdown for ChatGPT — Claude and Cursor were trained to parse
<file>tags reliably; ChatGPT and Gemini do best with## File:headings and fenced code blocks. - Respect .gitignore — never send
node_modules; it is routinely 90%+ of a project's file count and close to 0% of what a model needs to answer a question about your code. - Chunk large repos by feature, not size — if a repo doesn't fit one context window, send
src/componentsfirst, thensrc/utils, rather than an arbitrary byte cutoff that splits a file in half. - Add an instruction, don't just paste code — "This is a Next.js app using the App Router. Review the auth flow for bugs" gets a sharper answer than the code alone. Use a template above, or write your own.
- Exclude binaries — images, fonts, and archives cost tokens and tell a text model nothing; they're filtered out by default here.
XML vs Markdown vs Repopack — which format?
| Format | Best for | Example |
|---|---|---|
| XML | Claude, Cursor | <file path="src/x.ts">…</file> |
| Markdown | ChatGPT, Gemini | ## File: src/x.ts + fenced block |
| Repopack | Any model, matches Repomix CLI output | ===== File: src/x.ts ===== |
How many tokens does a codebase use?
Your current selection is about 73 tokens. As a rule of thumb, 100 files averaging 100 lines each run roughly 25,000 tokens — well inside GPT-4o's 128K window and a small fraction of Claude's or Gemini's million-token windows. The stats bar above updates live as you check and uncheck files, so you can see the real number for your project rather than a rule of thumb.
Related tools
- Token Counter — count tokens and cost for any text, across nine models.
- Smart Token Reducer — cut prompt tokens from text you already have.
- Docs to LLM — the same idea for DOCX, PPTX, XLSX, and HTML.
- Data to LLM — CSV/JSON to LLM-ready context.
Codebase running large? Cut whitespace and filler with Smart Token Reducer →
Frequently asked questions
How do I feed my codebase to ChatGPT?
Drop your project folder onto this tool. It auto-respects .gitignore and excludes node_modules, .git, dist, build, and .next by default, then builds a single prompt with a file tree followed by every selected file. Switch to the Markdown tab (ChatGPT reads that best) and click "Copy for ChatGPT" — paste it straight into the chat.
How do I convert a GitHub repo to an LLM prompt?
Paste the repo URL (e.g. github.com/owner/repo, optionally with /tree/branch/subfolder) into "Paste GitHub URL" and click Fetch. The tool calls GitHub's public API from your browser to list the repo's files, then pulls each file's raw content the same way it would from a dropped folder. Private repositories aren't supported — download a ZIP, unzip it, and drop the folder instead.
Does it support .gitignore?
Yes. The nearest .gitignore at the root of what you dropped is read automatically and parsed with the same `ignore` library ESLint and Prettier use for their own ignore files — including negation patterns and `**` globs, not just a literal string match. Turn the toggle off to include everything instead.
What is Repopack / Repomix, and is this an online alternative?
Repopack (now Repomix) and code2prompt are command-line tools that pack a repository into one file for an LLM — useful, but they need Node.js and a terminal. This tool does the same job as a free web page: drag, select, copy. The Repopack output tab even matches its separator-style format, so existing prompts built for it keep working.
Is my code private?
Yes. Dropped folders and files are read with the browser's File API and never leave your device — there is no upload, no account, and this page makes no server call for that path. The one exception is "Paste GitHub URL", which fetches directly from GitHub's own API and CDN from your browser (not through Toolsda's servers) — the same as opening the file on github.com yourself.
Can it handle a large codebase with hundreds of files?
Yes, up to a few thousand files. Files over 1MB are listed but not read in (large files are almost always generated or bundled, not context worth the tokens), and the token count and per-model "fits in context" check update live so you can see before pasting whether the whole thing fits GPT-4o's 128K or Claude's much larger window. For anything that doesn't fit, select a subfolder instead of the whole tree.
XML, Markdown, Repopack, or Plain — which format should I use?
XML (`<file path="…">`) is what Claude and Cursor parse most reliably. Markdown (`## File: path` + a fenced code block) is the safest bet for ChatGPT and Gemini, and reads well for a human too. Repopack's `===== File: path =====` separators work with any model and match the format Repomix's CLI output uses. Plain is just every file concatenated — smallest, but the model has no path information to go on.