# Brute Force

> You try each possible answer in turn. You stop when one works.

**Field:** Software Development  
**Category:** Algorithms & Data Structures  
**Also known as:** Brute-Force Search, Exhaustive Search

## Think of it like

Think of it like a big ring of keys. You try each key until one opens the door.

## Definition

Brute force solves a problem by trying every possible answer until one works. It is simple to write and always finds the answer, if there is one. The trouble is the number of tries, which can grow huge very fast. A 4-digit code has 10,000 options, but a 12-letter password has far more than anyone could try. It is often the first version, before a smarter one replaces it.

## Example

Jack forgot his 3-digit bike lock code. Trying every code from 000 to 999 opens it in at most 1,000 tries.

## Why it matters

It gives a right answer to test smart methods against. It is fine when the options are few.

## Common mistake

Shipping brute force without counting the options. Ten items have 3.6 million orders; twenty have far too many to try.

## Three principles

- **Try everything.** Until one works.
- **Always correct.** If it finishes.
- **Grows fast.** Count the options first.

## Related terms

- [Algorithm](https://learn.benibix.com/term/development/algorithm)
- [Greedy Algorithm](https://learn.benibix.com/term/development/greedy-algorithm)
- [Dynamic Programming](https://learn.benibix.com/term/development/dynamic-programming)
- [Big O Notation](https://learn.benibix.com/term/development/big-o-notation)
- [Backtracking](https://learn.benibix.com/term/development/backtracking)

## Told apart from

- [Backtracking vs Brute Force](https://learn.benibix.com/compare/backtracking-vs-brute-force): Brute force tries every full answer. Backtracking builds an answer step by step and gives up on a path as soon as it cannot work, so it skips most of the tries.

---

Source: https://learn.benibix.com/term/development/brute-force
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
