Best local LLM for coding in 2026, by hardware
Updated 2026-11-14. From official model cards, LMArena Code Arena and our local finder's estimates.
On a 24GB GPU, Qwen3.8 27B at Q5 is the best local coding model (about 31 tokens per second by our estimate). On a 32GB Mac, Qwen3.6 35B A3B is the pick. With only 16GB of VRAM, gpt-oss-20b is the one coding model that fits well. A 128GB Mac can run gpt-oss-120b. Local models code about as well as small cloud models: Qwen3.8 27B ranks #27 of 53 on Code Arena.
Best local coding model by hardware
| Your machine | Best quality | Fastest good pick | Try it |
|---|---|---|---|
| 8GB GPU (RTX 4060) ~7 GB usable | No coding model fits well Small fallback: Gemma 4 E4B Q4, ~60 tok/s | Use a cheap API for real coding work | Finder |
| 12GB GPU (RTX 3060) ~11 GB usable | No coding model fits well Small fallback: Gemma 4 E4B Q8, ~45 tok/s | Use a cheap API for real coding work | Finder |
| 16GB GPU (RTX 4060 Ti 16GB) ~15 GB usable | gpt-oss-20b Q4 ~13 GB, ~80 tok/s (fast) | Same | Finder |
| 24GB GPU (RTX 4090) ~23 GB usable | Qwen3.8 27B Q5 ~20 GB, ~31 tok/s (fast) | Gemma 4 31B Q4 ~18 GB, ~33 tok/s (fast) | Finder |
| 32GB GPU (RTX 5090) ~31 GB usable | Qwen3.8 27B Q5 ~20 GB, ~54 tok/s (fast) | Recursive Flint 40B A2.5B Q5 ~28 GB, ~604 tok/s (fast) | Finder |
| PC, 32GB RAM, no GPU ~19 GB usable | Gemma 4 26B A4B Q4 ~15 GB, ~16 tok/s (usable) | Same | Finder |
| Mac, M4 16GB ~11 GB usable | No coding model fits well Small fallback: Gemma 4 E4B Q8, ~15 tok/s | Use a cheap API for real coding work | Finder |
| Mac, M5 24GB ~16 GB usable | gpt-oss-20b Q4 ~13 GB, ~42 tok/s (fast) | Same | Finder |
| Mac, M5 32GB ~24 GB usable | Qwen3.6 35B A3B Q4 ~21 GB, ~51 tok/s (fast) | Same | Finder |
| Mac, M5 Pro 48GB ~36 GB usable | Qwen3.8 27B Q4 ~17 GB, ~11 tok/s (slow) | Recursive Flint 40B A2.5B Q5 ~28 GB, ~103 tok/s (fast) | Finder |
| Mac, M4 Max 64GB ~48 GB usable | Qwen3.8 27B Q5 ~20 GB, ~17 tok/s (usable) | Recursive Flint 40B A2.5B Q8 ~42 GB, ~123 tok/s (fast) | Finder |
| Mac, M5 Max 128GB ~96 GB usable | gpt-oss-120b Q5 ~83 GB, ~101 tok/s (fast) | Same | Finder |
Picks come from the coding group in our local model finder: the highest-rated coding model that fits with room for context and runs at 8+ tokens per second, at the best quant that stays above 12 tokens per second. Speeds are our estimates (memory bandwidth x 0.6 / bytes read per token). Usable memory is our estimate after the OS and display.
How good is local coding, really?
Only one model in our finder has a Code Arena rank so far: Qwen3.8 27B. It sits at #27 of the 53 models we price on Code Arena, just behind Claude Haiku 5.5 and ahead of MiniMax-M3.1 Flash, Gemini 3.8 Flash and GPT-6 Luna. The top of the board is Claude Fable 5.2, which scores far higher. In plain terms: a 27B model on your own GPU codes about as well as the small, cheap cloud models, not the flagships.
That is fine for autocomplete, explaining code, writing tests and small edits, and the code never leaves your machine. For long agent runs across a big repo, a frontier cloud model still wins clearly.
If privacy is not the reason you want local, compare the bill first. The Code Arena value picks right now are MiMo-V2.6 Flash ($0.17 per 1M tokens blended), GLM-5.3 Flash ($0.24 per 1M tokens blended) and DeepSeek V4.1 Flash ($0.53 per 1M tokens blended). See the best model for coding page and the cheapest LLM API guide.
Mixture of experts vs dense for coding
Speed on local hardware depends on how many weights each token has to read. A mixture-of-experts model such as Qwen3 Coder 30B A3B or Recursive Flint only reads its active slice (about 2.5B to 3.3B weights) per token, so it stays fast even on a laptop. A dense 27B model reads all 27B every token, which is why the same Mac that runs Flint at 100+ tokens per second runs Qwen3.8 27B at around 11 to 17 (our estimates).
The trade-off is memory. MoE models still need all their weights loaded, so a 40B MoE needs more room than a 27B dense model. If your machine has the memory but modest bandwidth (most Macs, CPU-only PCs), pick MoE. If you have a fast 24GB or 32GB GPU, dense models are quick enough, and the dense Qwen3.8 27B is the only finder model with a Code Arena rank.
Every coding model in our finder, smallest first
| Model | Size | Type | Q4 download | Memory needed | License |
|---|---|---|---|---|---|
| gpt-oss-20b OpenAI | 21B (3.6B active) | Mixture of experts | ~13 GB | ~14 GB | Apache 2.0 |
| Gemma 4 26B A4B | 25.2B (3.8B active) | Mixture of experts | ~15 GB | ~17 GB | Apache 2.0 |
| Qwen3.6 27B Qwen | 27B | Dense | ~16 GB | ~18 GB | See model card |
| Qwen3.8 27B Qwen | 27.8B | Dense | ~17 GB | ~18 GB | Apache 2.0 |
| Muse Glimmer 30B Meta | 29.6B | Dense | ~18 GB | ~19 GB | Apache 2.0 |
| Qwen3 Coder 30B A3B Qwen | 30.5B (3.3B active) | Mixture of experts | ~18 GB | ~20 GB | Apache 2.0 |
| Gemma 4 31B | 30.7B | Dense | ~18 GB | ~20 GB | Apache 2.0 |
| DeepSeek R1 Distill Qwen 32B DeepSeek | 32.8B | Dense | ~20 GB | ~21 GB | MIT |
| Nanbeige4.3 33B Nanbeige | 33.1B | Dense | ~20 GB | ~21 GB | Apache 2.0 |
| Qwen3.6 35B A3B Qwen | 35B (3B active) | Mixture of experts | ~21 GB | ~22 GB | See model card |
| Recursive Flint 40B A2.5B Recursive | 39.8B (2.5B active) | Mixture of experts | ~24 GB | ~25 GB | Apache 2.0 |
| gpt-oss-120b OpenAI | 117B (5.1B active) | Mixture of experts | ~70 GB | ~72 GB | Apache 2.0 |
| Mistral Small 4 Mistral | 119B (6.5B active) | Mixture of experts | ~71 GB | ~73 GB | Apache 2.0 |
| Ornith 1.5 122B Ornith AI | 122B (10B active) | Mixture of experts | ~73 GB | ~75 GB | MIT |
| Qwen3.8 Flash Next Qwen | 180B (6B active) | Mixture of experts | ~108 GB | ~110 GB | Qwen Community License |
Q4 is about 4.8 bits per weight. Memory needed adds about 1.5 GB for context and runtime (our estimate); long coding sessions with big files need more. Sizes from each model's official card. Models that need hundreds of GB (Muse Spark Open) are left out.
Using a local model with your editor or coding agent
Ollama and LM Studio both run a local server with an OpenAI-compatible API, so most editors and agents that let you set a custom endpoint can use it. Pull the model and quant from the tables above, then point the tool at the local server.
Coding agents send long prompts (whole files, tool output), so give the model a bigger context window than you would for chat, and expect it to use more memory than the download size. If a model is close to your memory limit, drop to the next smaller pick rather than going below Q4.
Sources
Model sizes and licenses come from each official model card, linked from every model's requirements page.
FAQ
What is the best local LLM for coding?
It depends on memory. Qwen3.8 27B is the best quality pick on a 24GB GPU, Qwen3.6 35B A3B on a 32GB Mac and gpt-oss-120b on a 128GB Mac, based on our local finder.
Can I run a coding model on 8GB or 12GB of VRAM?
Not a good one. None of the coding models in our finder fit 8GB or 12GB with room for context. Small models can help with autocomplete, but for real coding work a cheap API is better value.
What is the best local coding model for 16GB VRAM?
gpt-oss-20b at Q4, about 13 GB and roughly 80 tokens per second by our estimate.
Is a local LLM as good as Claude or GPT for coding?
No. The best local model with a Code Arena rank, Qwen3.8 27B, is #27 of 53 models we price, close to Claude Haiku 5.5 and Gemini 3.8 Flash. Claude Fable 5.2 leads the board.
Is mixture of experts better for local coding?
On Macs and CPU-only PCs, usually yes, because each token reads only the active weights, so it runs much faster. On a fast 24GB or 32GB GPU, a dense 27B model is quick enough.
Which tools can use a local coding model?
Ollama and LM Studio both expose an OpenAI-compatible local server, so editors and agents that accept a custom endpoint can use it.
Related
- Local model finder
- Best local models
- Best model for coding
- Recursive Flint: the local coding model
- Best local LLM for a 32GB Mac
- Best local LLM for an RTX 5070 Ti
- Best local LLM for 16GB VRAM
- VRAM and memory requirements by model
- Cheapest LLM API
More guides
- Best Chinese LLM APIs in 2026
- Cheapest AI API for coding in 2026, by quality level
- GLM API pricing explained
- Grok API pricing explained
- Kimi API pricing explained
- MiniMax API pricing explained
Not sure a plan beats the API for you? Try the plan vs API cost calculator.