A text box is a common element of graphical user interface of computer programs, as well as the corresponding type of widget used when programming GUIs. A text box's purpose is to allow the user to input text information to be used by the program.

A typical text box is a rectangle of any size, possibly with a border that separates the text box from the rest of the interface. Text boxes may contain zero, one, or two scrollbars. Some text boxes change the number of scrollbars to fit the length of the text they contain. It is common for text boxes to contain a prompt, usually in the form of a blinking vertical line, indicating the current region of text being edited. It is common for the mouse cursor to change its shape when it hovers over a text box.

An example of a text box is used in the Go/Search feature on every page of Wikipedia.