Emacs Slow or Freezing With Large Files

Share
Workaround available Windows, macOS, Linux Updated November 14, 2026Based on 3 user reportsHow we research

Quick answer

Emacs can hang on huge files or files with very long lines because font-lock and major modes work on the whole buffer. Use so-long, fundamental mode or a large file warning threshold.

Most likely fix: Enable so-long

How to fix it

Try these in order — the most common fix is first.

  1. 1. Enable so-long

    1. Run M-x global-so-long-mode
    2. Add (global-so-long-mode 1) to your init file
    3. Emacs switches to a lightweight mode on files with very long lines
    Did this fix it?
  2. 2. Open as plain text

    1. Run M-x fundamental-mode in the buffer
    2. Or open the file with M-x find-file-literally
    Did this fix it?
  3. 3. Check your packages

    1. Disable indent-guides, linters and LSP in the buffer to test
    2. Use C-g to interrupt a hung command
    Did this fix it?
  4. 4. Use a viewer for huge logs

    1. Try the vlf package (View Large Files) from MELPA
    Did this fix it?

Symptoms

Emacs freezes when opening a big log, JSON or minified file; scrolling lags; typing is delayed in large source files.

Why it happens

  • Syntax highlighting and indentation on very long lines
  • Extra minor modes such as indent guides, LSP or linters running on large buffers
  • Emacs reading the whole file into memory

This guide also covers

  • emacs slow large files
  • emacs freezes opening big file
  • emacs long lines slow

Still not working?

If GNU Emacs keeps failing, you're not alone. See every GNU Emacs problem users report or the alternatives people switch to.

Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.

Talk to us
Fixed it? Share this guide

The same problem in other apps

All crashes, freezes & blank screens guides →

Other GNU Emacs errors