A codebook is the reference document that tells you (or anyone else) exactly what each piece of data in a study means and how it was assigned. In quantitative research it maps every variable to its possible values; in qualitative research it maps every code to the meaning, boundaries, and example text that justify applying it. The two traditions share a name and a purpose — making analysis transparent and repeatable — but the document itself looks different in each.
Codebook meaning: the short answer
A codebook is a structured record that defines the coding scheme used to turn raw data into analyzable data. It exists so that a second researcher — or the same researcher six months later — can look at a variable or a code and know precisely what it represents, without having to guess or re-derive the logic. Every codebook, regardless of discipline, answers the same underlying question: what does this label actually mean, and how do I know when it applies?
The term splits into two related but distinct uses:
- Quantitative codebook (also called a data codebook or variable codebook): documents every variable in a dataset — its name, label, permitted values, and missing-value conventions. This is the sense used by data archives such as ICPSR and the General Social Survey (GSS), where the codebook ships alongside the dataset itself.
- Qualitative codebook: documents every code used to label segments of text (interview transcripts, field notes, open-ended survey responses) — its definition, inclusion and exclusion criteria, and an example of text that illustrates it.
If you only need the short version: a codebook is the key that makes your data legible to someone who wasn’t in the room when you collected or coded it.
The quantitative codebook: anatomy and example
A quantitative codebook is built around variables, not cases. For each variable in a dataset, it records enough detail that someone with only the codebook and the raw data file could reconstruct what every value means. The core elements are:
- Variable name — the short machine-readable identifier used in the dataset (e.g., a column header).
- Variable label — a plain-language description of what the variable measures.
- Value codes and value labels — the numeric or categorical codes used in the data, and what each one means (e.g.,
1 = Yes,2 = No). - Missing-value conventions — how non-responses, skips, and refusals are distinguished from one another (e.g.,
-99 = Not applicable,-98 = Refused,-97 = Don't know). - Data type and format — whether the variable is numeric, string, date, or categorical, and any formatting rules.
- Source or derivation note — whether the variable was collected directly (e.g., from a survey item) or computed from other variables, and if so, how.
An illustrative example of a single entry from a survey codebook:
| Field | Entry |
|---|---|
| Variable name | Q14_EMPSTAT |
| Variable label | Current employment status |
| Value codes | 1 = Employed full-time; 2 = Employed part-time; 3 = Unemployed, looking; 4 = Not in labor force |
| Missing values | -98 = Refused; -99 = Not asked (skip pattern) |
| Data type | Categorical (integer) |
| Source | Directly collected, survey item Q14 |
This is the sense of “codebook” used when researchers ask for a codebook for quantitative research: it is documentation for the dataset, not an analytical framework. It is closely related to, but not identical to, a data dictionary — see the comparison below.
The qualitative codebook: anatomy and example
A codebook in qualitative research documents the coding scheme applied to text data during analysis — for example, in thematic analysis, content analysis, or grounded theory. Rather than describing variables, it describes codes: the labels a researcher applies to meaningful segments of text. A well-built qualitative codebook typically includes:
- Code name — a short, consistent label for the concept.
- Definition — what the code means, written precisely enough that two coders would apply it the same way.
- Inclusion criteria — the conditions under which the code should be applied.
- Exclusion criteria — text that looks similar but should NOT receive this code, and why.
- Example quote — a real (or representative) excerpt that illustrates correct application.
- Parent code / hierarchy position — where the code sits if the scheme is organized into themes and sub-codes.
An illustrative example of a single entry from a qualitative codebook:
| Field | Entry |
|---|---|
| Code name | Access_Barrier_Cost |
| Definition | Participant describes cost as a reason for not using or delaying use of a service. |
| Inclusion | Any explicit reference to affordability, price, or inability to pay. |
| Exclusion | General dissatisfaction with a service that does not mention cost (code instead as Access_Barrier_Quality). |
| Example quote | “I would have gone back, but after the second visit I just couldn’t keep paying out of pocket.” |
| Parent code | Access_Barrier (theme) |
Qualitative codebooks are usually built and revised inside coding software such as NVivo, ATLAS.ti, or MAXQDA, but the codebook itself — as a document — is what makes the coding scheme auditable independent of any specific tool. For the mechanics of applying codes to transcripts, see coding qualitative interview data.
How to build a codebook: step by step
The process differs slightly by tradition, but both follow the same underlying logic: define categories, apply them consistently, and document disagreements or revisions.
Building a quantitative codebook
- List every variable in the dataset, in the order they appear.
- Assign a variable name and label for each — the name should be stable and machine-readable; the label should be human-readable.
- Enumerate value codes for every categorical or coded variable, including all possible response options.
- Define missing-value conventions up front and apply them consistently — distinguish “not asked” from “asked but refused” from “asked but skipped due to routing.”
- Document derived variables — if a variable is computed from others (e.g., an age band derived from a birth year), record the formula or rule.
- Version the codebook alongside the dataset — if variables change between data releases, the codebook needs its own version history.
Building a qualitative codebook
- Start with a provisional set of codes — drawn deductively from your research questions or theoretical framework, inductively from an initial read of the data, or both.
- Write a working definition for each code before coding the full dataset, not after.
- Pilot the codebook on a subset of the data with more than one coder where possible, and compare results.
- Refine definitions and boundaries based on disagreements — most codebook revisions happen because two coders applied a code differently, which usually means the definition was ambiguous.
- Add or split codes as new patterns emerge, and retire codes that turn out to be redundant or too broad to be useful.
- Freeze the codebook once it is stable, and apply it consistently to the remaining data — further changes at that point require re-checking previously coded material.
Codebook vs. data dictionary
These two terms are often used interchangeably, which causes confusion. In practice, “data dictionary” is the broader, discipline-agnostic term for documentation that describes a dataset’s structure (fields, types, constraints), while “codebook” is the term most commonly used in the social and health sciences specifically for the version that includes value codes and, often, the substantive meaning of survey items. Every codebook is a kind of data dictionary; not every data dictionary is called a codebook. For a full breakdown of the fields each document typically contains, see data dictionary in research data management.
Codebook vs. DDI Codebook (the metadata standard)
“Codebook” is also the name of a specific machine-readable metadata standard: the DDI Codebook format from the Data Documentation Initiative. This is an XML specification for encoding exactly the kind of variable-level documentation described above so that it can be read by software and archived in repositories such as ICPSR. If you are looking for the XML/metadata standard rather than the general concept of “a document that defines my variables or codes,” that term is what you want — it formalizes the quantitative codebook described in this guide into a structured, interoperable format.
Common mistakes
- Writing the codebook after coding is finished. A codebook built retroactively tends to describe what one coder happened to do rather than a rule a second coder could follow. Draft definitions before or during the first pass, and revise as needed.
- Vague code or variable definitions. “Positive experience” is not a usable code definition; “participant explicitly states satisfaction with wait time or staff responsiveness” is.
- No missing-value convention. Treating blank, “not applicable,” and “refused” as the same thing loses information that often matters for analysis.
- No version history. Codebooks change as datasets and coding schemes evolve; without dated versions, it becomes impossible to know which codebook applies to which wave of data.
- No inclusion/exclusion criteria in qualitative codebooks. A code name and one-line definition are rarely enough to get two coders to agree; boundary cases need to be spelled out explicitly.
Frequently asked questions
What is a codebook in research?
A codebook is a document that defines the meaning of every variable (in quantitative research) or every code (in qualitative research) used in a study, so the data can be interpreted consistently and independently of the person who originally collected or coded it.
What is the difference between a codebook and a code book?
None — “codebook” and “code book” are the same concept, just written as one word or two. Both refer to the same type of research documentation.
Is a codebook the same as a data dictionary?
They overlap heavily. “Data dictionary” is the broader term for structural documentation of a dataset; “codebook” is the term most often used in social science and health research for the version that also documents value codes and item meaning. See the comparison above.
Do qualitative studies need a codebook?
Yes, if the analysis involves systematic coding of text (thematic analysis, content analysis, framework analysis, much of grounded theory). A codebook is what makes qualitative coding auditable and, when more than one coder is involved, comparable across coders.
What software is used to build a qualitative codebook?
Common choices include NVivo, ATLAS.ti, and MAXQDA, all of which let researchers define codes, apply them to text, and export the codebook as a standalone document. The codebook itself is a description of the coding scheme, not something that requires any particular software to exist.







