Guide · Open source
How to use Repomix: pack a codebase into one file for AI
Updated · written with AI from the project's own documentation and checked against our catalogue data
Repomix is a free, MIT-licensed tool written in TypeScript that scans a project folder and combines all of its files into one output file. It is built for giving an AI assistant such as ChatGPT or Claude the full context of a codebase at once. This guide shows you how to install it, run it, read the output and use it well.
Quick start
- 1Check Node.js. Repomix needs Node.js installed. Confirm it is available on your machine before continuing.
- 2Run Repomix with npx. Run npx repomix@latest in your project directory to try it without installing anything.
- 3Install globally (optional). Install with npm install -g repomix, or with Homebrew on macOS or Linux, for repeated use.
- 4Pack the project. Run repomix in the project folder to create repomix-output.xml in the current directory.
- 5Review the token counts. Check the token counts per file and for the whole repository against your model's context limit.
- 6Attach the file to an AI tool. Upload the output file to your AI assistant with a clear prompt describing the task.
Install Repomix or run it without installing
Repomix is distributed as a package and needs Node.js. You can try it once with npx, or install it globally for repeated use.
The README lists these install options: npm, yarn, bun and Homebrew (macOS/Linux).
- Run without installing: npx repomix@latest
- Install globally with npm: npm install -g repomix
- Install with Homebrew (macOS/Linux): brew install repomix
npx repomix@latestPack your project with one command
Change into your project directory and run repomix. The README says this is all it takes to pack the entire repository. Repomix writes a repomix-output.xml file in the current directory containing your code in an AI-friendly format.
cd your-project
repomixSend the output file to an AI assistant
Attach the generated file to your AI assistant and give it a clear prompt. The README gives this example: the file contains all repository files combined, and you want the code reviewed before a refactor.
When you propose specific changes, the AI may be able to generate code accordingly. Some assistants, such as Claude with Artifacts, may output multiple files.
This file contains all the files in the repository combined into one.
I want to refactor the code, so please review it first.Understand what Repomix includes and leaves out
Repomix respects your .gitignore, .ignore and .repomixignore files, so ignored files stay out of the output. It also uses Secretlint to detect files matching known credential formats and leave them out.
Token counts are provided for each file and for the whole repository, which helps when your model has a limited context window.
- Respects .gitignore, .ignore and .repomixignore
- Counts tokens per file and for the entire repository
- Uses Secretlint to leave out files matching known credential formats
- The --compress option uses Tree-sitter to extract key code elements and reduce tokens while keeping structure
Use the website or browser extension instead of the terminal
If you prefer not to use a terminal, the website at repomix.com lets you enter a repository name, fill in optional details and click Pack. You can choose XML, Markdown or Plain Text output and see an instant token count estimate.
A Chrome extension and a Firefox add-on add a Repomix button to GitHub repository pages. A community-maintained VSCode extension called Repomix Runner is also available.
- Website: repomix.com
- Chrome extension: Repomix on the Chrome Web Store
- Firefox add-on: Repomix on Firefox Add-ons
- VSCode: Repomix Runner (community-maintained)
What people use it for
- Asking ChatGPT or Claude questions about a whole project at once
- Reviewing code before a refactor by sending one file as input
- Checking whether a codebase fits an LLM's context window using token counts
- Packing a repository into Markdown or Plain Text for different AI tools
Frequently asked questions
Is Repomix free to use?
Repomix is open source and released under the MIT licence. The source does not list paid tiers, so check the project's README and homepage for current details.
What do I need to install Repomix?
The README lists Node.js as the prerequisite. You can run it with npx repomix@latest without a separate install, or install it with npm, yarn, bun or Homebrew.
Which AI tools can I use the output with?
The project says it is meant for feeding codebases to LLMs and AI tools such as Claude, ChatGPT, DeepSeek, Perplexity, Gemini, Gemma, Llama and Grok. The output is a single file you can attach or paste.
Will Repomix remove all my secrets?
No. Repomix uses Secretlint to leave out files that match known credential formats. The README does not promise guaranteed removal, so review the output before sharing it.
My codebase is too large for the AI. What can I do?
A single output file may exceed a model's context window. Check the token counts, and consider the --compress option, which uses Tree-sitter to reduce tokens while keeping structure, or pack only the parts you need using ignore rules.
How does Repomix compare to gitingest or code2prompt?
The source lists gitingest, files-to-prompt, code2prompt and repo2txt as comparable projects. It does not benchmark them, so try a few on your own repository to see which output suits your workflow.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Repomix suits developers who want an AI assistant to see a whole project at once, especially if they are comfortable running a Node.js command. It is less suitable for very large codebases that exceed a model's context window, or for anyone who needs guaranteed secret removal, since it relies on pattern matching.
Install options & downloads