Text File Merger for LLM Context

Combine text files, source code, or a whole folder into one AI-ready document without uploading your files.

The merger keeps each filename or relative folder path as a source wrapper, counts the result with the bundled o200k_base tokenizer, and can shorten the merge to a context-window budget before you copy or download it.

Tip: Add a .ignore file to any folder you want to skip. For example, placing it inside project/node_modules/ excludes that directory and its subfolders from the merge.

How to merge text files and folders

  1. Drop files below, or choose Select Files or Select Folder.
  2. Review the combined preview, file count, and local token count. You can append more files without starting over.
  3. Optionally set a token budget, then copy or download the resulting merged TXT file.

Drag and drop text files here

or

Supported file extensions (click to edit)

🔒 Files are processed entirely in your browser and are never uploaded to a server.

Combine text and code files for AI context

A useful LLM prompt often needs more than one source file. This text file merger turns a selection of TXT, Markdown, JSON, YAML, JavaScript, TypeScript, Python, HTML, CSS, and other editable file types into one structured document. It is designed for code review, repository questions, document comparison, research notes, and any workflow where an AI assistant needs several local sources in a single context.

Keep file paths and boundaries

Every file is wrapped with its filename or relative folder path, so the model can tell where one source ends and the next begins.

Count tokens before you paste

See the merged size with the local o200k_base tokenizer before sending the document to an LLM.

Fit a context-window budget

Choose 8K, 32K, 128K, 200K, 1M, or a custom limit to cap merges that exceed the target without changing the original files.

Turn a codebase into one LLM-ready document

Selecting a project folder is the fastest way to prepare a small repository for ChatGPT or another long-context model. Edit the supported-extension list first so generated assets, binaries, and unrelated formats stay out. With Exclude .gitignore files enabled, the tool filters files matched by common .gitignore patterns. A folder-level .ignore marker gives you another simple way to omit build output, dependencies, secrets, or test fixtures.

  1. If the repository is unfamiliar, make a compact overview with the Codebase Map Generator.
  2. Merge only the source and documentation files relevant to your question.
  3. Check the token total, leave room for your instructions and the model's answer, and apply a budget if needed.
  4. Ask a focused question and tell the model to cite the included file paths in its response.

Trim merged text to a model context budget

The token trimmer reduces each included file by the same proportion, removing text from the end while preserving every path wrapper. This keeps all sources represented, but it is a mechanical trim rather than a relevance ranking or summary. Review the preview after trimming, especially when important definitions or conclusions appear near the end of a file.

The displayed count is exact for the bundled o200k_base encoding. A model with a different tokenizer may report another total, so reserve extra space when the destination model does not use that encoding.

Private, browser-based file merging

File contents stay on your device: the browser reads, combines, counts, and trims them locally. The on-page preview is capped at 4 MB to keep the interface responsive, while the complete merged result remains available for download. Browser clipboard limits can also affect exceptionally large strings, so use the TXT download for very large codebases or document sets.

Text file merger FAQ

Can I merge a whole folder instead of selecting files one by one?

Yes. Choose Select Folder. Relative paths are kept in the combined document, and you can append another file or folder afterward.

Which file types can I combine?

The default list covers common text, configuration, web, and programming formats. Open Supported file extensions to add or remove extensions before selecting a folder.

Does the tool upload my code or documents?

No. Selected file contents are processed in your browser. Nothing is sent to this site's server.

How does trim-to-budget work?

It proportionally shortens every file from the end until the merged document fits the requested o200k_base token budget. It does not edit the source files on disk.

Can I combine webpage content too?

Use the URL to Markdown & HTML to Text Converter to clean one or more webpages first, then add the downloaded text to this merger.