Quick answer
Data normalization puts data into a standard form. In databases it means organizing tables into normal forms so each fact is stored once; in statistics and machine learning it means rescaling numbers, for example to a 0–1 range or to z-scores, so variables can be compared.
Formula: Min-max: x′ = (x − min) ÷ (max − min); z-score: x′ = (x − mean) ÷ SD
What is data normalization?
Data normalization means putting data into a standard form so that it can be stored or compared consistently. The phrase names two quite different techniques, and mixing them up wastes a lot of meeting time:
| Database normalization | Feature scaling | |
|---|---|---|
| Field | Relational database design | Statistics and machine learning |
| What changes | How data is split into tables | The numeric values in a column |
| Goal | Store each fact once, avoid update anomalies | Put variables on comparable scales |
| Typical steps | First, second and third normal form | Min-max, z-score, log transform |
| Information lost | None, if tables can be joined back | Original units, unless you keep the parameters |
If a developer says "this table isn't normalized", they mean the left column. If an analyst says "normalize the features before clustering", they mean the right one.
Database normalization: 1NF, 2NF and 3NF
E. F. Codd introduced the relational model and the idea of a normal form in 1970. Microsoft's description of database normalization puts the aim plainly: organize tables and relationships to protect the data and to eliminate redundancy and inconsistent dependency. Three forms cover most practical design:
| Normal form | Rule in plain words | Violation to look for |
|---|---|---|
| First (1NF) | One value per field, no repeating groups, each row identified by a key | A "products" cell holding a list; columns named item1, item2, item3 |
| Second (2NF) | Every non-key field depends on the whole key, not part of it | In an order-line table, a product name that depends only on the product ID |
| Third (3NF) | Non-key fields do not depend on other non-key fields | A customer's city stored on each order, when it depends on the customer |
William Kent's widely cited guide compresses the second and third forms into one line: a non-key field must provide a fact about the key, the whole key, and nothing but the key. Higher forms exist, but Microsoft's article calls third normal form the highest level necessary for most applications.
Worked example: normalizing an orders table
Sample data. A shop exports orders like this, with a list in one cell:
| order_id | order_date | customer_id | customer_city | items |
|---|---|---|---|---|
| 5001 | Nov 2 | C7 | Leeds | P1 Mug × 2 at $9; P2 Notebook × 1 at $5 |
| 5002 | Nov 3 | C7 | Leeds | P2 Notebook × 3 at $5 |
| 5003 | Nov 3 | C9 | Hamburg | P1 Mug × 1 at $9 |
Step 1, 1NF. Give each order line its own row. The key becomes (order_id, product_id).
| order_id | product_id | order_date | customer_id | customer_city | product_name | qty | unit_price |
|---|---|---|---|---|---|---|---|
| 5001 | P1 | Nov 2 | C7 | Leeds | Mug | 2 | 9 |
| 5001 | P2 | Nov 2 | C7 | Leeds | Notebook | 1 | 5 |
| 5002 | P2 | Nov 3 | C7 | Leeds | Notebook | 3 | 5 |
| 5003 | P1 | Nov 3 | C9 | Hamburg | Mug | 1 | 9 |
Now every cell holds one value, but facts repeat. If customer C7 moves, three rows must change. Miss one and the same customer lives in two cities.
Step 2, 2NF. product_name depends only on product_id; order_date, customer_id and customer_city depend only on order_id. Move each group to its own table.
Step 3, 3NF. customer_city depends on customer_id, which is not the key of the orders table. Move it to a customers table.
| Table | Columns (key first) | Rows |
|---|---|---|
| customers | customer_id, city | 2 |
| products | product_id, name | 2 |
| orders | order_id, order_date, customer_id | 3 |
| order_items | order_id + product_id, qty, unit_price | 4 |
C7's move is now one update in one row. Note where unit_price stayed: it is the price charged on that line at that time, so it is a fact about the order line, not about the product. A current list price would belong in products. Normalization depends on what each field means, not on which values happen to repeat today.
The check is that joining the four tables returns the four order lines of step 1, with revenue unchanged: 18 + 5 + 15 + 9 = $47.
When to denormalize
Normalized tables are good for writing and for consistency. Analytical queries often read many rows across many joins, so warehouses and reporting layers deliberately copy attributes back into wide or star-shaped tables. Microsoft's article makes the practical point too: many small tables may degrade performance, and it may be more feasible to apply third normal form to the data that changes often.
A usable rule: normalize the system of record, denormalize copies built from it, and make sure the copies are rebuilt rather than edited by hand. Deciding which version of a customer's city an old order should show (then or now) is a modeling choice that normalization forces you to make explicitly.
Feature scaling: min-max and z-score
In the second sense, normalization changes numbers so that a variable measured in dollars does not dominate one measured in sessions. The common methods, with formulas as given in Google's machine learning course:
| Method | Formula | Result | Good when |
|---|---|---|---|
| Min-max (linear scaling) | x′ = (x − min) ÷ (max − min) | Range 0 to 1 | Stable bounds, few outliers |
| Z-score (standardization) | x′ = (x − mean) ÷ standard deviation | Mean 0, standard deviation 1 | Roughly bell-shaped values |
| Log scaling | x′ = ln(x) | Compresses a long tail | Heavily skewed, positive values |
| Clipping | cap values at a threshold | Limits extremes | A few outliers distort everything |
Libraries use the words loosely. In scikit-learn, StandardScaler computes z-scores, MinMaxScaler does min-max, and the class actually called Normalizer does a third thing: it rescales each row to unit length.
Worked example: scaling two features
Sample data: five accounts described by sessions in 30 days and monthly spend. The means are 10 sessions and $140; the population standard deviations are 4.90 and $181.74.
| Account | Sessions | Spend | Sessions min-max | Spend min-max | Sessions z | Spend z |
|---|---|---|---|---|---|---|
| A | 4 | $20 | 0.000 | 0.000 | −1.22 | −0.66 |
| B | 6 | $35 | 0.143 | 0.031 | −0.82 | −0.58 |
| C | 10 | $50 | 0.429 | 0.063 | 0.00 | −0.50 |
| D | 12 | $95 | 0.571 | 0.156 | 0.41 | −0.25 |
| E | 18 | $500 | 1.000 | 1.000 | 1.63 | 1.98 |
For account B: sessions min-max = (6 − 4) ÷ (18 − 4) = 0.143; z = (6 − 10) ÷ 4.90 = −0.82.
Why it matters. Ask which account is most similar to C, using straight-line distance:
| Distance from C | Raw values | Min-max | Z-score |
|---|---|---|---|
| to B | 15.5 | 0.29 | 0.82 |
| to D | 45.0 | 0.17 | 0.48 |
| Nearest | B | D | D |
On raw values, dollars swamp sessions, so B looks closest. After scaling, both features count and D is closer. A clustering or nearest-neighbor method would put C in a different group depending on this one preprocessing choice.
The outlier problem. E's $500 squeezes the other four into 0 to 0.16 on spend. Taking logs first and then applying min-max spreads them to 0.00, 0.17, 0.28, 0.48 and 1.00. scikit-learn's documentation recommends robust scalers, which use more robust estimates of center and range, when data has many outliers.
Which method should you use?
- Comparing people or products on several measures, or using distance-based methods: z-score, or log then z-score for skewed money and counts.
- Feeding a score that must stay between 0 and 1, with known limits: min-max with those fixed limits, not with whatever today's sample shows.
- Tree-based models: scaling usually changes little, because splits depend on order.
- Reporting to people: keep original units and add a rate instead.
That last one is a third everyday meaning, rate normalization. Sample: page A logs 120 errors in 60,000 sessions and page B 90 errors in 30,000. B has fewer errors but a higher rate, 3.0 against 2.0 per 1,000 sessions.
Normalization vs standardization vs data cleaning
| Term | What it does | Order |
|---|---|---|
| Data preparation | The whole path from raw data to analysis-ready data | Contains the others |
| Data cleaning | Fixes errors, duplicates and inconsistent formats | First |
| Standardization (z-score) | One specific scaling method | After cleaning |
| Normalization (scaling) | Umbrella term, sometimes meaning min-max only | After cleaning |
Scaling a column that still contains test accounts or mixed currencies only makes the errors harder to see. See data cleaning techniques for that first step.
Common normalization mistakes
- Not saying which meaning you intend. Write "3NF" or "z-score".
- Fitting the scaler on all the data. Compute min, max, mean and standard deviation on the training set only and reuse them on new data; otherwise information leaks from the test set into the model.
- Re-fitting every week. A score of 0.4 then means something different each time.
- Dividing by zero. A constant column has no range and no standard deviation; drop it.
- Normalizing away history. Overwriting a customer's city loses where past orders shipped; keep the value on the transaction if reports need it.
Where TapCub fits
TapCub is not a database design tool and does not scale features. It helps with the step before scaling: getting consistent inputs out of behavioral data.
- Fix one meaning per property. In All-platform analytics › Data › Property dictionary, check each key's type and intake rules, so an amount is not sometimes text.
- Pull one row per subject. In All-platform analytics › Behavior › SQL query, a query such as
SELECT subject, COUNT(*) AS sessions FROM v_sessions WHERE {filters} GROUP BY subjectgives a feature column; download the result as CSV (up to 50,000 rows). - Use rates on dashboards. In All-platform analytics › Behavior › Metrics & SQL, define per-person or ratio metrics so that large and small segments can be compared.
- Scale outside. Apply min-max or z-scores in your spreadsheet or code, and store the parameters with the model.
Sources
- E. F. Codd, A Relational Model of Data for Large Shared Data Banks, Communications of the ACM 13(6), 1970.
- Microsoft Learn, Database normalization description.
- William Kent, A Simple Guide to Five Normal Forms in Relational Database Theory.
- Google, Machine Learning Crash Course: Normalization.
- scikit-learn, Preprocessing data.
Was this explanation clear?
We use your answers to fix and expand this page.
Couldn’t send. Please try again in a minute.
Thanks for the feedback. We’ll use it to improve this page.You’ve already sent feedback on this page. Thanks.

Product Experience Specialist
Writes about product experience, practical workflows, and growth, turning complex processes into clear steps for everyday decisions.