# Hash Table

> A store of keys and values. It finds a value by its key in one step.

**Field:** Software Development  
**Category:** Algorithms & Data Structures  
**Also known as:** Hash Map, Hashmap, Dictionary (Data Structure)

## Think of it like

Think of it like a coat check. Your ticket number says exactly which hook your coat is on.

## Definition

A hash table stores pairs of keys and values. It finds a value by its key in one quick step. A hash function turns each key into a number that says where to keep it. To look it up again, the table runs the same function and goes straight there. On average, finding, adding and removing all take O(1) time. Python's dict and JavaScript's Map are hash tables.

## Example

Emma's app keeps 2 million users in a hash table keyed by email. Finding one user takes the same time as finding one of 10.

## Why it matters

It is the fastest common way to look things up by name. Caches, databases and counters all use one.

## Common mistake

Expecting the keys to come out in order. Many hash tables keep no order; sort the keys if you need one.

## Three principles

- **Keys and values.** Find a value by its key.
- **A hash picks the spot.** Same key, same spot.
- **O(1) on average.** However many items.

## Related terms

- [Dictionary](https://learn.benibix.com/term/development/dictionary)
- [Data Structure](https://learn.benibix.com/term/development/data-structure)
- [Array](https://learn.benibix.com/term/development/array)
- [Big O Notation](https://learn.benibix.com/term/development/big-o-notation)
- [Hash Collision](https://learn.benibix.com/term/development/hash-collision)

---

Source: https://learn.benibix.com/term/development/hash-table
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.
