# Arduino “Sketch too big”: text section exceeds available space

> Fix the Arduino sketch too big error on Uno and Nano: shrink flash use, remove unused libraries, use F\(\) and move to a bigger board.

Canonical: https://roboticsengineering.in/fix/arduino-sketch-too-big-text-section-exceeds/ | Published: 2026-11-03 | Updated: 2026-11-04

**The program does not fit in flash.** An Uno has about 32 KB of program space after the bootloader, and a few libraries together can fill it.

## What the message means

The compiler reports program storage used against the maximum. When the used figure exceeds the maximum, the upload stops with “Sketch too big” or “text section exceeds available space in board”.

## Fix it in this order

1. Read the program storage line after compiling to see how far over you are.
2. Remove libraries and code you do not use. Large display and Wi-Fi libraries are the usual cause.
3. Wrap fixed text in the F() macro, and drop debug prints you no longer need.
4. Use smaller data types and remove duplicate lookup tables.
5. Replace a heavy library with a lighter one made for small boards.
6. If it still does not fit, move to a board with more flash, such as a Mega or an ESP32.

## Why it happens

The compiler places the program code in a fixed-size flash memory. The IDE reports how many bytes the sketch uses and how many the board offers. Your sketch, every library it includes, and the core’s startup code all add to that total. When the total passes the limit, the linker stops with a message about the text section exceeding the available space.

Large libraries are a common cause, because a display or networking library can add many kilobytes even if you use only a few functions. Strings stored in code and debug output also take space. Flash and RAM are different: a RAM warning means variables use too much memory at run time, while the too-big error is about program storage.

## If you see this, do this

| You see | Do this |
| --- | --- |
| Over by a few hundred bytes | Remove debug prints and use F(). |
| Over by a lot | A large library is the cause. Replace it or change the board. |
| Fits but RAM warning appears | See the low memory page. |

## Confirm the fix

1. Note the program storage figure after compiling and compare it with the board maximum. The gap shows how much to remove.
2. Compile a blank sketch that includes only the library you suspect. Its size shows how much that library costs before your own code is added.
3. Remove one large block of debug prints and recompile. A drop in the reported size confirms the change saved program storage.

**Common mistake:** Many readers assume that a too-big error comes from global variables, when it is a program storage limit, and RAM use is a separate warning.

## Related

[low memory warning](https://roboticsengineering.in/fix/arduino-low-memory-available-stability-problems-f-macro/), [best Arduino board for robotics](https://roboticsengineering.in/best-arduino-board-for-robotics-india/).

Last reviewed: November 2026. These are the usual causes and the order that finds them fastest. Test on your own board; clones and cables differ.
