Web Building Blocks Beginner

What Is a Bug?

A bug is a mistake in code that makes a program act wrong.

Infographic: What Is a Bug? It shows how a mistake in code makes a program behave in silly or wrong ways.
Download the poster

A bug is a mistake in code that makes a program act wrong. It is not a real insect!

A bug happens when something in the code is missing, wrong, or does not work the way it should. Then the program does something we did not mean.

Bugs can make programs act in silly or unexpected ways: a game freezes, a button does not work, or you get a wrong answer.

Here is a real example. A weather app should show the temperature in Celsius, but a bug shows the wrong value, like minus 250 degrees. Oops, that cannot be right! Once it is fixed, it shows the correct number again.

How do people find bugs? They test, look closely, try unexpected things, and read messages and logs. Good bug hunters are curious and patient.

Remember: a bug is a mistake in the code, not a real insect, bugs can cause weird results, and fixing them makes apps work better.

What to remember

  • A bug is a mistake in the code.
  • It is not a real insect in the computer.
  • Bugs can cause crashes, wrong answers, or weird behavior.
  • Testing and looking closely help find them.

Words to know

Bug
A mistake in code that makes a program act wrong.
Crash
When a program suddenly stops working.
Test
Trying a program out to find problems.
Log
A record of what a program did, useful for finding bugs.

For grown-ups

A bug is a defect in code that produces incorrect or unexpected behavior; the term dates to early computing lore. Finding bugs relies on testing, reproduction, reading errors and logs, and narrowing down the cause, skills that reward curiosity and patience.

Want the full story? These go deeper: