Law Firm Automation - Plain-English automation guides for boutique law firms (personal injury, estate, immigration)

Stop typing diagnosis codes off medical bills by hand.

Every medical bill in a case file carries a string of ICD codes, and your paralegal copies them one at a time.

One digit typed wrong and the diagnosis on your chronology is a different injury. We’d like to show you how those codes can be read, checked against the official list and tied to each visit on their own, with your team looking only at the doubtful ones.

Thank you, we have your message. An AI automation expert will be in touch with you soon, by email or by text if you asked for that.

Something went wrong sending that. Please check your name and email and try again.

It’s free to contact us for a consultation. An AI automation expert will get in touch by email, or by text or phone if you prefer.

We can save you time by showing you exactly what the tool will do, so you can judge for yourself whether it fits your business. Everyone talks about AI systems; we show you how one real, repetitive task in your business gets solved, and you keep using it only if it actually helps you.

We won’t bore you with “AI systems.” What it really comes down to is understanding the problem you’re trying to solve, and matching it with a solution we may already have built for another business like yours. We’ve helped 175 businesses so far (updated November 1, 2026). Could you be next?

How to Extract ICD Codes from Medical Bills PDFs (and Check Them)

You probably won’t find this in a law-firm blog, but a 2016 American Journal of Neuroradiology history says the United States adopted Jacques Bertillon’s list of causes of death in 1898, and that ICD-10 grew the code count from 17,000 to about 155,000.

By · Updated

Hello, and welcome to everyone who has typed S13.4XXA from a bill and wondered whether that was an X or a K.

Every medical bill in a personal injury file carries the same quiet row: a handful of ICD-10-CM codes that say what the provider is billing for.

I spent December 2, 2026 reading the instructions for the two standard US claim forms, Amazon’s ICD-10-CM documentation and a 2016 history of the code system, instead of the vendor blogs that quote each other.

Three things stood out. The CMS-1500 form tells billers to leave the decimal point out, a code that fits a 7-character slot can still be wrong, and many itemized bills carry no codes at all.

Short answer: To extract ICD codes from a medical bills PDF, read the diagnosis boxes with OCR or a vision AI model, put the decimal back (S134XXA becomes S13.4XXA), check each code against the official ICD-10-CM list for the date of service, link each to the billed line it supports, and send unreadable or unmatched codes to a paralegal.

What does an ICD-10-CM code look like on a medical bill?

An ICD-10-CM code is three to seven letters and digits: a letter, two characters, then up to four more that add detail. Written for people it has a decimal after the third character, such as M54.2.

The 2016 AJNR history says the codes are alphanumeric, with a possible 7 digits of specificity, against 5 in ICD-9. The first three characters name the general condition, and each later one narrows it.

Real ICD-10-CM codes a neck injury bill might list, and how they print (our examples; code meanings from the CDC code set, checked December 2, 2026)
Code with decimalAs printed on a CMS-1500What it says
S13.4XXAS134XXASprain of ligaments of cervical spine, initial encounter
M54.2M542Cervicalgia (neck pain)
G44.309G44309Post-traumatic headache, unspecified, not intractable
V43.52XAV4352XACar driver injured in collision with another type of car in a traffic accident, initial encounter

The X in S13.4XXA is a placeholder, and the last letter A marks the initial encounter. A reader that drops either one has not read the code; it has read a different one.

Where do the CMS-1500 and the UB-04 print ICD codes?

On a physician’s CMS-1500, the codes sit in Item 21 and each billed line points to them from Item 24E. On a hospital’s UB-04, the principal diagnosis is form locator 67, with others beside it.

The NUCC instructions for the 1500 claim form say Item 21 takes an ICD indicator (0 for ICD-10-CM) and up to 12 codes, and that the decimal point is not entered because it is implied. Item 24E holds the letters A to L that point back to those codes.

Where diagnosis and procedure codes sit on the two standard bills (compiled by Law Firm Automation from the NUCC 1500 instructions and Premera’s UB-04 guide, December 2, 2026)
Form and boxWhat it holdsWhat to do with it
CMS-1500 Item 21ICD indicator and up to 12 diagnosis codes, lettered A to LRead all 12 slots; restore decimals
CMS-1500 Item 24EPointer letters tying each billed line to Item 21Link code to visit and CPT line
CMS-1500 Item 24DCPT or HCPCS procedure code (what was done)Keep beside the diagnosis; it is a different code set
UB-04 form locator 67Principal diagnosisThe headline diagnosis of the stay or visit
UB-04 form locators 67A to 67QOther diagnoses at the time of admission or procedureRead every one; the count differs by payer
UB-04 form locator 69Admitting diagnosisInpatient stays only
UB-04 form locator 74Principal procedure: ICD-10-PCS (inpatient) or CPT (outpatient)Procedure codes, not diagnoses

Premera’s UB-04 billing guide says the same of the hospital form: The ICD-10 CM code can be up to seven digits without a decimal. So both standard bills leave the decimal off, while chart notes and many portals print it.

One honest limit: we could not open the NUCC manual itself or the CMS chapter 25 text, so the box details come from the instructions as other sources quote them. Check the box numbers against a bill from your own providers before you build on them.

Why do some medical bills carry no ICD codes at all?

Because many bills in a file are not claim forms. A patient statement, a ledger or a charge list shows dates, descriptions and amounts, and the diagnosis codes live on the claim the provider sent to the insurer.

A personal injury vendor’s billing itemization playbook, as a search summary showed it to us, says an itemized record should list dates of service, CPT and ICD codes, line charges and payments, and that a missing code can be fixed by asking the billing department for a corrected statement. We did not open the full page.

Say you open a clinic’s one-page ledger and see Office visit, March 4, $180 with no code anywhere. No reader, human or machine, can find a code that was never printed. The right move is a records request for the claim or a corrected statement, which is why automated medical record retrieval follow up sits right beside this job.

So a good extractor does not guess. A page with no code gets the label no diagnosis code on this page, and the request goes back to the provider.

How do you extract ICD codes from a medical bills PDF automatically?

You extract ICD codes automatically in four steps: read the diagnosis boxes, fix and check each code, link it to its billed line, and flag whatever fails.

A sample CMS-1500 bill with Item 21 listing codes S134XXA, M542 and G44309 and two lines with pointers A and AB, beside four steps: read, fix and check, link, flag
The bill shows codes without decimals. The pipeline restores them, checks each against the official list and ties each to the visit it supports.
  1. Read. OCR or a vision AI model finds the diagnosis boxes on each bill page, even when the scan is crooked, and returns each code with its page number and the box it came from.
  2. Fix and check. The decimal goes back after the third character, letters are checked against digits, and each code is looked up in the ICD-10-CM list that was in force on the date of service.
  3. Link. The pointer letters in Item 24E tie each code to the billed line, so S13.4XXA is attached to the March 4 visit and its CPT code.
  4. Flag. A code that is not on the list, a bill with no code, or a code with no matching visit note waits for a paralegal with the page image beside it.

The sample bill in the diagram is invented. On a real file, the same four steps run on every bill page before a person opens the stack.

Why does a simple ICD code pattern grab vitamin B12 and miss I10?

Because a code is just a letter and a few digits, and so are lots of other things on a medical page. A pattern loose enough to catch every code also catches B12 and T12; a strict one misses valid short codes like I10.

We ran two patterns of our own on six short test lines. The loose one, a letter, two characters and then an optional decimal and up to four more, found every real code in our bill lines, with or without decimals. It also returned “B12” from a vitamin B12 level and “T12” from a spinal level.

The strict one, which demands a decimal or at least four characters, ignored both. It also ignores I10, which is a real three-character code for hypertension, so it would miss one on a real bill.

What two simple code patterns did on our six test lines (our test, December 2, 2026; lines are invented)
PatternCaught real codesFalse hits on our linesMisses
Loose: letter, two characters, optional decimal, up to four moreAll of them, with or without decimalsB12 (vitamin), T12 (vertebra)None on our lines
Strict: needs a decimal, or at least four charactersAll the longer onesNone on our linesValid three-character codes such as I10

The cure is not a cleverer pattern. It is the look-up: every candidate is checked against the real code list, and the words around it (“Dx”, “Diagnosis”, Item 21) decide whether it was meant as a code.

One more small thing I found while reading. The AJNR history says the letter U is the only letter not used in ICD-10-CM codes. That was true in 2016, but the American Hospital Association’s March 18, 2020 note shows U07.1 (COVID-19) took effect on April 1, 2020. Any pattern that skips U is out of date.

Which tools can read ICD codes from medical bills?

Three kinds of tool do the job: a service that finds codes in text, a service that reads the page, and a vision model that does both in one request.

The calm part of a checked code list is the decimal. Nobody has to remember where it goes; the list already has it, and the page is one click away.

How three services handle ICD codes (compiled by Law Firm Automation from each maker’s documentation, November 27 to December 2, 2026)
ServiceWhat it does with codesWhat you still build
Amazon Comprehend Medical InferICD10CMReads text that describes a condition and suggests matching ICD-10-CM codes with confidence scores, listed in descending order of confidenceOCR first; it maps clinical wording to codes, so it is a poor reader for a code that is already printed on a bill
Amazon Textract QueriesAnswers plain questions on a scanned page, such as What are the diagnosis codes?, with a confidence score and locationThe question list per bill type and the code checks
Claude PDF supportReads each page as text plus an image, so it can list every printed code with its box, line and pointer in one JSON answerSplitting large packets and the look-up against the official code list

Read the Comprehend Medical row twice. Its InferICD10CM operation is made for the opposite job: Use InferICD10CM to detect possible medical conditions as entities and link them to codes from the 2026 ICD-10-CM version. That is useful on a chart note that says neck pain with no code, and it is a guess, not a reading.

For a bill that already prints S13.4XXA, you want to read the code, not infer it. Amazon also says that in this service a time expression is only returned if they are associated with an entity, so dates need a separate step, as extract dates from medical records PDF shows.

My pick for printed codes is a vision model for the reading, plus a plain code-list look-up for the checking. I would add Comprehend Medical only for chart notes with no code. Skip all of it if your bills come as clean electronic files, where the codes are already data.

Which year’s ICD-10-CM list does a bill’s code belong to?

It belongs to the list in force on the date of service. The CDC says FY 2027 codes apply to services from October 1, 2026 through September 30, 2027, and the release replaces the FY 2026 one.

That matters for a file with bills from three different years. A code can be valid in 2025 and gone by 2027, so the look-up must use the right year’s list for each visit.

Where sources disagree: how big the FY 2027 ICD-10-CM update is (read December 2, 2026; figures are from secondary sources, not the CDC files themselves)
Source typeNew codesCaveat
Summaries citing the CDC/NCHS addendum190 new, 30 deleted, total 74,879 (up from 74,719)We did not open the CDC addendum; the arithmetic is consistent (190 minus 30 is 160, and 74,719 plus 160 is 74,879)
Some vendor articles238 newDifferent counting; does not reconcile with the 74,879 total
One code-list site150 newLooks like an outlier
CDC files pageNo count on the pageStates the October 1, 2026 to September 30, 2027 use period

In short: do not quote a new-code count to anyone until you have opened the CDC addendum yourself. The part that does not change is the rule: look the code up in the year of the visit.

The same AJNR history gives the scale of the whole system: ICD-10 expanded from 17,000 codes to approximately 155,000.

We could not tell how that count was made, so we use it only as the history’s own figure, not as a count of the diagnosis list.

How long does it take to copy ICD codes from medical bills by hand?

At 45 seconds a bill page, hand-copying codes from 300 bill pages takes about 3.75 hours. A person must find the box, read each code and type it with the decimal.

Our calculation: hand-copying codes versus machine reading, per stack of bill pages (Law Firm Automation, December 2, 2026; assumptions below)
Bill pagesHours by hand at 45 seconds a pageWage cost at $30.24 an hourAmazon Textract QueriesClaude Sonnet 5.5
1001.25$38$1.50$0.76 to $1.06
3003.75$113$4.50$2.29 to $3.19
6007.5$227$9.00$4.58 to $6.38

Assumptions: 45 seconds a page is our round figure for finding the diagnosis boxes, reading up to a dozen codes and typing them, not a measured time. The wage is the US median paralegal pay of $30.24 an hour from the Bureau of Labor Statistics (May 2025), with no benefits or overhead.

Machine costs use the list prices and the per-page token estimates we set out in our date-extraction guide, with one Textract query per page. More queries per page cost more. These numbers cover the reading only, not the review of flagged pages.

The real saving is not the reading. It is that a person opens only the pages the checks flag, not every page in the stack.

What checks stop a wrong ICD code reaching the demand letter?

Six checks catch most wrong codes before they reach a chronology, and any failure sends the page to a person instead of the file.

  1. The code exists in the ICD-10-CM list for the year of the date of service.
  2. The code has the right shape: the decimal after the third character and a placeholder X where the code calls for one.
  3. Every pointer letter in Item 24E points to a code that is actually filled in on Item 21.
  4. Each billed visit has a matching visit note, and the note’s description fits the code (a neck sprain code beside a note about a knee gets flagged).
  5. The same code is not simply repeated on every page of the packet; if it is, check whether it is a header or a template.
  6. A bill with no code is labelled no code on this page and added to the records request list.

The extracted codes then feed the next steps: a chronology that medical chronology software for personal injury builds, and a first draft when you automate demand letter drafting. A code list that is checked and cited makes both safer.

Is it safe to send medical bills to AI, and where should a firm start?

Sending bills to an AI service is safe only when the vendor is covered by a business associate agreement or equivalent terms, does not train on your files, and your bar’s guidance on client confidentiality is followed.

A diagnosis code is health information tied to a person. Amazon Textract and Comprehend Medical are on the AWS HIPAA eligible services list, which AWS says applies after an AWS business associate agreement is signed. Ask any vendor in writing where files are stored and for how long.

Then start small. A sensible first week runs the extraction on one closed file whose bills your team already logged by hand:

  1. Day 1: pick a closed file with a mix of claim forms, ledgers and a hospital bill.
  2. Day 2: run the bills through one reader and produce the code list with page cites.
  3. Day 3: compare it with your paralegal’s list, code by code, and count misses and false hits.
  4. Day 4: add the checks above for the misses you found.
  5. Day 5: run a new bill stack in shadow mode while your team works as usual.

If the reader cannot match your team on its own closed file, it is not ready for a live case.

Here is what the pieces add up to.

A code only means something for its year, its visit and its pointer, and a ledger carries none of the three. So when a bill gives you no code, the fastest fix is a records request, not a better scanner, and the most useful thing the software does is tell you which requests to send.

The United States took up Bertillon’s list of causes of death in 1898, according to that AJNR history. More than a century on, the same idea sits in a box on a bill, and a checked code in that box still beats a retyped one.

How we researched this

  • Read the Amazon Comprehend Medical InferICD10CM documentation, the CDC’s ICD-10-CM files page, Premera’s UB-04 billing guide, the American Hospital Association’s March 18, 2020 note on U07.1 and the 2016 AJNR history ICD-10: History and Context on December 2, 2026, plus the Textract and Claude pages used in our date-extraction guide on November 27, 2026.
  • The NUCC 1500 manual and CMS chapter 25 would not open as text for us, so the CMS-1500 and UB-04 box details come from secondary summaries of those instructions. The Attorney Assistant playbook was seen only as a search summary. The FY 2027 code counts come from secondary sources, not the CDC addendum.
  • We ran two simple code patterns on six invented test lines to see what they caught; that is our own small test, not a benchmark. Our search for Reddit threads on this exact job returned no usable discussion, so we cite none. We did not test any vendor tool or set up any system for this article.

Let the reading happen first, keep the judgment with your paralegal, and see which bills still need a call to the provider.

Sources and further reading

Questions and answers

Can I use AI to extract ICD codes from a medical bills PDF?

Yes. OCR or a vision AI model can read the diagnosis boxes on a CMS-1500 or UB-04 bill, restore the decimal, and list each code with its page citation. A paralegal should check every code against the official ICD-10-CM list for the date of service and review anything the software flags.

Where are the ICD codes on a medical bill?

On a CMS-1500 physician bill, diagnosis codes are in Item 21, up to 12 of them lettered A to L, and each billed line points to them in Item 24E. On a UB-04 hospital bill, the principal diagnosis is form locator 67 and other diagnoses follow in 67A to 67Q.

Why do ICD codes on a bill have no decimal point?

The NUCC instructions for the CMS-1500 say not to enter the decimal because it is implied, and the UB-04 guides say the same. So S13.4XXA prints as S134XXA, and an extraction tool has to put the decimal back after the third character.

What if the medical bill has no ICD codes on it?

Then the bill is probably a ledger or patient statement, not the claim form. Ask the provider’s billing department for the itemized claim or a corrected statement that lists the codes, and mark that page in your file as having no diagnosis code.

Is an ICD code the same as a CPT code?

No. An ICD-10-CM code says what the diagnosis is, such as M54.2 for neck pain. A CPT code says what was done, such as 99213 for an office visit. A bill lists both, and the pointer letters in Item 24E connect each procedure to its diagnosis.

How this was written: Written from the NUCC 1500 Claim Form instructions for Item 21 and Item 24E (through secondary summaries; the manual PDF itself would not open for us), Premera’s UB-04 billing guide, the Amazon Comprehend Medical InferICD10CM documentation, the CDC’s ICD-10-CM files page, the American Hospital Association’s March 18, 2020 news item on code U07.1, a 2016 American Journal of Neuroradiology history of ICD-10, our own earlier Law Firm Automation guides and the Textract and Claude pages they cite, all read between November 27 and December 2, 2026. Time and cost figures are our own calculation with the assumptions stated. We describe how such automations work; we have not installed one in your firm.

Oh, one more thing…

If this helped, you’ll like our free updates: the insights we discover while researching, and the moments worth sharing with other boutique law firms (personal injury, estate, immigration) — no spam, no promotions.

One short email when there’s something worth your time. Unsubscribe any time.