Skip to content
Free planNo credit card requiredStart writing

How to code qualitative data: a step-by-step guide with a codebook

Updated 10 min read

Short answer:

To code qualitative data, you attach short labels (codes) to segments of your transcripts that capture what matters for your research question, record each code in a codebook with a definition, then group the codes into categories and themes. The work happens in cycles: a first pass that labels widely, a second pass that merges and organizes, and a final step where you test themes against cases that do not fit.

This guide is for master's and PhD students and researchers coding interviews, focus groups or open-text survey answers for the first time. It walks through each step with an invented worked example and a sample codebook. For where AI fits, see our main guide to AI for qualitative research.

What is qualitative coding?

A code is a word or short phrase that you assign to a segment of data to capture its meaning for your question. Saldaña's The Coding Manual for Qualitative Researchers, now in its fifth edition (2025), describes more than 35 coding methods and divides them into first-cycle and second-cycle methods [1].

Coding is not the analysis itself. It is the way you organize the data so you can see patterns, and it is also where your interpretation starts. Two researchers with different questions will code the same transcript differently, and that is expected.

Before you start, decide your overall approach, because it changes how you code:

ApproachHow codes are madeQuality check
Inductive (data-driven)Codes come from the dataAudit trail, reflexivity
Deductive (theory-driven)Codes come from a theory or framework set in advanceCoverage of the framework, often agreement between coders
HybridA starting codebook, extended with new codes from the dataBoth

Our guide to inductive vs deductive coding covers this choice in detail.

How to code qualitative data, step by step

1. Prepare and de-identify your transcripts

Code from clean, verbatim transcripts. If you used a transcription service or software, check the text against the audio; our guide to interview transcription explains how.

Then de-identify. Replace names, workplaces, towns and rare details with consistent labels such as [Participant 07] or [Hospital B], and keep the key that links labels to people in a separate, secured file. Give each transcript an ID and number its lines or paragraphs so every quote can be traced back.

2. Get familiar with the data

Read every transcript in full before you code anything, and listen to some recordings again. Write short memos as you go: what surprised you, what participants repeated, what they avoided. Familiarization is the first phase of Braun and Clarke's thematic analysis, and skipping it is the most common reason for shallow codes [2].

3. First-cycle coding

Go through the data line by line or segment by segment and label what is relevant to your question. Three first-cycle methods cover most interview studies [1]:

  • Descriptive codes summarize the topic of a passage in a noun or short phrase: "night shift schedule", "family support".
  • In vivo codes use the participant's own words, in quotation marks: "running on fumes".
  • Process codes use gerunds (-ing words) to capture action: "hiding tiredness", "negotiating swaps".

You can mix them. Code generously in this cycle: one passage can carry several codes, and it is easier to merge codes later than to go back for ones you missed.

4. Build the codebook

Every time you create a code you expect to reuse, add it to a codebook. A usable codebook entry has five parts:

FieldWhat it holds
CodeA short label, used exactly the same way every time
DefinitionOne or two sentences on what the code means
Include whenThe conditions under which you apply it
Exclude whenNear misses, and which code to use instead
ExampleA short quote from the data, with its transcript ID

The include and exclude rules do most of the work. They stop codes from drifting as you move through 20 transcripts, and they let a second coder or your supervisor see exactly what you meant. Version the codebook: save a dated copy whenever you change a definition.

5. Second-cycle coding

In the second cycle you work with the codes, not the raw text. Merge codes that mean the same thing, split codes that hold two ideas, drop codes that do not bear on the question, and group related codes into categories. Saldaña's second-cycle methods include pattern coding, which groups codes into a smaller number of explanatory categories, and focused coding, which keeps the most frequent or significant codes [1].

6. From codes to themes

A theme is a pattern of shared meaning across the dataset, organized around a central idea. In reflexive thematic analysis, Braun and Clarke stress that themes are generated by the researcher through interpretation, not found waiting in the data, and that a theme is not the same as a topic summary such as "experiences of support" [2][3].

To develop themes:

  1. Cluster codes on a whiteboard or in a table and ask what idea holds each cluster together.
  2. Name each candidate theme as a claim, not a topic.
  3. Write two or three sentences defining the theme and its boundaries.
  4. Check the theme against all the coded extracts, then against the full dataset.

7. Look for negative cases

A negative case is a participant or passage that does not fit a pattern you have identified. Search for them on purpose. A negative case either sharpens a theme's boundaries ("this holds for nurses on fixed rosters, not rotating ones") or shows that the theme is weaker than you thought. Report them; they are evidence of a careful analysis, not a weakness.

8. Decide on reliability or reflexivity

This depends on the approach you chose before you started. Coding-reliability and some codebook approaches have two people code the same transcripts independently and report agreement, often with Cohen's kappa; see Cohen's kappa and inter-rater reliability. Reflexive thematic analysis does not use inter-rater agreement, because it treats your perspective as part of the analysis; instead you keep a reflexive journal and an audit trail of decisions [3]. Do not mix the two by reporting kappa for a reflexive analysis.

9. Report the coding

Describe who coded, how many transcripts, which coding methods, how the codebook developed, how themes were generated and how you handled negative cases. Two reporting guidelines are widely used:

  • COREQ (2007), the 32-item checklist for interviews and focus groups [4].
  • SRQR (2014), the 21-item Standards for Reporting Qualitative Research, for qualitative studies in general [5].

Put the final codebook in an appendix or supplementary file.

A worked example (invented)

Example (invented for illustration): a master's student interviews 14 early-career nurses about how they manage sleep between night shifts. This excerpt is from transcript N07, lines 112 to 119:

"Honestly, after a run of nights I'm running on fumes. I'll get home, and I know I should sleep, but I scroll on my phone for an hour because it's the only time that's mine. My partner thinks I'm mad. Then I set three alarms because I'm terrified of sleeping through and being late for handover. I'd never tell the charge nurse I'm that tired, though. You just don't."

First-cycle codes:

LinesSegmentCodeType
112"running on fumes""running on fumes"In vivo
113–114scrolls on phone instead of sleepingClaiming personal timeProcess
115partner's reactionFamily response to sleep habitsDescriptive
116–117three alarms, fear of latenessGuarding against oversleepingProcess
118–119would not tell charge nurseHiding tiredness from seniorsProcess

Codebook entry for one code:

FieldEntry
CodeHiding tiredness from seniors
DefinitionThe participant describes not disclosing fatigue to a charge nurse, manager or senior colleague.
Include whenNon-disclosure is to someone with authority over shifts or assessment.
Exclude whenNon-disclosure is to family or peers (use "Masking tiredness from others"); fatigue is reported but no concealment is described.
Example"I'd never tell the charge nurse I'm that tired, though. You just don't." (N07, 118–119)

Second cycle and themes: across all 14 transcripts, the student had 87 first-cycle codes. Merging and dropping left 31. "Hiding tiredness from seniors", "Swapping shifts quietly" and "Fear of looking weak" clustered into a candidate theme she named "Fatigue as a private failure". Two participants on fixed night rosters described telling their manager openly; she reported them as negative cases that limit the theme to rotating rosters.

Common mistakes

  • Coding before reading. You code the first transcripts too narrowly and have to recode them.
  • Topic labels as themes. "Support" or "Workload" are topics. A theme says something about them.
  • No exclude rules. Codes drift and overlap; nobody else can apply them.
  • Ignoring cases that do not fit. Reviewers notice when every participant agrees.

Coding qualitative data in AI for Research

The qualitative workbook in Workbooks (the /workbooks route) holds the same structure as this guide: a codebook with code, definition, include when and exclude when; coded excerpts with the exact quote and a negative-case flag; and themes. You can upload a transcript, select text to code it, and see code frequency by source.

AI code suggestions are optional and cost 3 credits. Each suggestion quotes the passage it rests on, so you can check it against the transcript and accept, edit or reject it. The AI does not generate your themes. Upload only de-identified transcripts, and only if your ethics approval covers the use. See qualitative coding for details.

When you write up, the reporting guideline checker in the Reviewer drafts a COREQ 2007 or SRQR 2014 checklist from your manuscript, item by item, with the passage that reports each one, for 5 credits per 10,000 words. You confirm each item yourself. The Free plan has 45 credits a month; see pricing.

FAQ

What are the steps to code qualitative data?

Prepare and de-identify your transcripts, read them all to get familiar with the data, then do a first cycle of coding with short labels such as descriptive, in vivo or process codes. Write each code into a codebook with a definition and include and exclude rules. In a second cycle, merge, split and group codes, then develop themes, test them against negative cases and report your process.

How many codes should a qualitative study have?

There is no correct number. First-cycle coding often produces dozens or even a few hundred codes, because you label everything that might matter. Second-cycle coding reduces them: you merge duplicates, drop codes that do not help answer the question and group the rest into categories and themes. A final codebook of 20 to 50 codes is common in interview studies, but the number depends on your data and approach.

What is a codebook in qualitative research?

A codebook is the list of codes you use, with a definition for each, rules for when to apply it and when not to, and a typical example from the data. It keeps your coding consistent across transcripts and coders, and it becomes part of your audit trail. Update it as codes change, and keep the old versions.

Do I need two coders for qualitative analysis?

Not always. Codebook and coding-reliability approaches often use two coders and report agreement, for example with Cohen's kappa. Reflexive thematic analysis does not, because it treats coding as interpretation rather than measurement; there you show quality through reflexivity, a clear audit trail and discussion with a supervisor or team. Choose the approach first, then the quality checks that belong to it.

What is the difference between a code and a theme?

A code is a short label for one feature of a data segment, such as "checks phone before bed". A theme is a pattern of shared meaning across many coded segments, built around a central idea that answers your research question, such as "sleep as something earned". Codes are the building blocks; themes are your interpretation of what they add up to.

Learn more

Sources

  1. Saldaña, J. (2025). The Coding Manual for Qualitative Researchers (5th ed.). Sage.
  2. Braun, V., & Clarke, V. (2006). Using thematic analysis in psychology. Qualitative Research in Psychology, 3(2), 77–101. https://doi.org/10.1191/1478088706qp063oa
  3. Braun, V., & Clarke, V. (2019). Reflecting on reflexive thematic analysis. Qualitative Research in Sport, Exercise and Health, 11(4), 589–597. https://doi.org/10.1080/2159676X.2019.1628806
  4. Tong, A., Sainsbury, P., & Craig, J. (2007). Consolidated criteria for reporting qualitative research (COREQ): a 32-item checklist for interviews and focus groups. International Journal for Quality in Health Care, 19(6), 349–357. https://doi.org/10.1093/intqhc/mzm042
  5. O'Brien, B. C., Harris, I. B., Beckman, T. J., Reed, D. A., & Cook, D. A. (2014). Standards for reporting qualitative research: a synthesis of recommendations. Academic Medicine, 89(9), 1245–1251. https://doi.org/10.1097/ACM.0000000000000388