Two-Way Frequency Table Calculator
Turn counts for two variables into row, column and whole-table percents, plus a segmented bar graph (PNG or SVG). Free, no sign-up.
Your table
Example: 50 students, grade by favorite lunch. Replace it with your own counts.
Clear all data?
Labels
Leave blank and it matches the shares you picked.
Hover over or tap a bar to see its value. From the keyboard, tab to the chart and use the arrow keys.
Add at least one category and number to download your chart.
Written from your data. Edit it if you like, then copy it into your document or web page.
Show data table
On this page
How to use the two-way table calculator
- Name the two variables. Type what the rows and columns stand for, like Grade and Favorite lunch.
- Enter the counts. Type how many fall in each cell, or paste a table from a spreadsheet with labels in the first row and first column.
- Pick the shares you need. Row % answers questions about each row. Column % answers questions about each column. Whole-table % shows each cell as a share of everyone. To compare groups, put the variable you think explains the other in the rows and read Row %, so each row adds up to 100%.
- Read the chart. The segmented bar graph puts one bar per row (or column) so you can compare the mix side by side.
- Copy or download. Copy the table into your homework, or download the chart as a PNG or SVG and the numbers as a CSV.
Row % and column % answer different questions. Try both before you choose one for your chart.
Joint, marginal and conditional relative frequency
A two-way frequency table, also called a contingency table, counts two categorical variables at once. OpenStax Introductory Statistics describes a contingency table as "a way of portraying data that can facilitate calculating probabilities." The same divisions give you relative frequencies:
- Joint: one cell ÷ the grand total. With the example data, grade 6 and pizza is 8 ÷ 50 = 0.16, or 16% of all students.
- Marginal: a row or column total ÷ the grand total. Pizza overall is 23 ÷ 50 = 46%.
- Conditional: one cell ÷ its row or column total. Within grade 6, pizza is 8 ÷ 16 = 50%. Among pizza fans, grade 6 is 8 ÷ 23, about 35% of them. That's a column share, so it answers a different question from the row shares below.
Say which total you divided by. 50% chose pizza means something different from 16% chose pizza, even though both come from the same cell.
With your data
Spotting a relationship between the two variables
Switch to Row % and compare the bars. If every row has about the same mix of columns, the two variables don't seem connected. If one row leans hard toward a column the others don't, they might be. In the example, pizza is about 50% for grade 6, 35% for grade 7 and 53% for grade 8, so grade 7 stands out.
Two cautions. A two-way table shows a pattern, not a cause. And with only a few people in a row, a difference of one or two answers can swing the percentages a lot, so check the counts too.
Two-way table vs segmented bar graph
They hold the same information. Statistics classes often ask for both.
| Measure | Two-way table | Segmented bar graph |
|---|---|---|
| What it shows | Exact numbers | Each row or column as one bar, split by share (a 100% stacked bar graph) |
| Makes it easy to | Look up an exact number | See the comparison at a glance |
For stacked bars without a two-way table, the stacked bar graph maker takes any data set, and the relative frequency bar graph maker handles a single categorical variable.
Related tools and guides
Frequently asked questions
What is a two-way frequency table?
It's a table that counts how often each combination of two categorical variables happens, like grade level and favorite lunch. Rows hold one variable, columns hold the other, and the totals sit along the right side and the bottom.
How do you find relative frequency in a two-way table?
Divide a count by a total. Which total depends on the question: the grand total for a share of everyone, the row total for a share within that row, or the column total for a share within that column.
What is the difference between joint and conditional relative frequency?
A joint relative frequency divides one cell by the grand total, so it describes everyone. A conditional relative frequency divides by a row or column total, so it describes only that group. "16% of all students are grade 6 pizza fans" is joint. "50% of grade 6 students chose pizza" is conditional.
How can I tell if the two variables are related?
Compare the row percentages. If every row has about the same mix, the variables don't look related. If the mix changes a lot from row to row, they might be. A table like this can't prove a cause, and small groups can show differences by chance.
Why don't my percents add up to exactly 100?
They do here. Rounding each cell on its own can leave a row at 99% or 101%, so this calculator rounds with the largest remainder method and every row, column or whole table adds up to exactly 100%. The CSV keeps the unrounded values.
How this page is checked
Cedrick Reese built this two-way table calculator on the same chart engine as the rest of BarGraphCreator. Row, column and whole-table shares were recalculated separately from the tool's own code against the 50-student example and against edge cases: a row of all zeros, a column of all zeros, three equal cells that must still add to 100%, and pasted tables with labels in the first row and column. The definitions follow OpenStax Introductory Statistics, section 3.4. The worked percentages are recalculated separately from the calculator code whenever that code changes.
Last updated: