# hledger for Vehicle Costs

Learn how to record fuel, insurance, repairs and service notes for a vehicle in an hledger journal, and how balance reports show what the car costs.

hledger for vehicle costs means recording every fuel fill, repair, fee and insurance payment as an account posting in a plain-text journal. The tool then totals those amounts per vehicle and per expense account, so you can see what the car costs without a spreadsheet. Service notes and dates belong in the same journal, next to the money. 

- Put each vehicle cost into its own expense account under a vehicle name, so reports separate cars cleanly.
- Record commodity amounts with the currency you actually paid, and let hledger convert when you need one total.
- Write service dates and repair notes as journal comments, so the record stays readable years later.
- Run a balance report on the vehicle expense accounts to answer what the car costs.
- Keep the journal in version control or a backup, because a single file holds the whole record.
 

## What hledger does with vehicle costs 

hledger is a plain-text accounting tool that reads a journal file and produces reports from it. Vehicle costs become ordinary account postings, so fuel, repairs and insurance sit beside every other expense in one file. Nothing is hidden in a database, and any text editor can open the record. 

The journal holds transactions written as plain lines: a date, a description, and two or more account postings with commodity amounts. A fuel purchase credits the cash or card account and debits a vehicle expense account. The same structure works for a private car, a van or a small fleet. 

Balance reports read that journal and total the postings per account. A report on the vehicle expense accounts answers what the vehicle costs over a period you choose. You control the account names, so the report structure follows how you think about the car. 

## Set up expense accounts per vehicle 

Expense accounts for vehicles should name the vehicle first, then the cost type, such as expenses:car:fuel or expenses:van:repairs. This order keeps all costs of one vehicle together in a sorted report. A second vehicle gets its own branch and never mixes with the first. 

A parent account such as expenses:car collects the children and shows one total for the vehicle. Separate children for fuel, insurance, repairs, tires, parking and fees let you see which cost type drives the total. Add only the branches you will actually record. 

Account names are yours to choose, and hledger does not demand a fixed chart. Pick names once and keep them stable, because renaming later touches every transaction. Write the naming plan in a comment at the top of the journal so the structure stays clear. 
| Account | What it records | 
| expenses:car:fuel | Fuel and charging payments | 
| expenses:car:repairs | Parts and labor for fixes | 
| expenses:car:insurance | Policy premiums | 
| expenses:car:fees | Registration and inspection charges | 
| assets:bank:checking | The account money leaves from |  

## Write a fuel transaction with commodity amounts 

A fuel transaction needs the date, the station or a short note, and the amount in the currency you paid. The commodity amount states the number and the currency symbol or code together. hledger adds the amount to the expense account and subtracts it from the payment account. 

If you track fuel volume, add a second commodity amount for liters or gallons on the same posting. hledger keeps both amounts and can report either one. Volume tracking helps compare consumption across fills without a separate log. 

One posting can carry the expense and another can carry the payment, and hledger balances the two. When a card payment covers several costs at once, split the expense across several postings in a single transaction. Each posting names its own vehicle expense account, so reports stay accurate. 

## Keep service notes and dates in the journal 

Service notes belong in the journal as comments attached to the transaction, not in a separate document. A comment line starting with a semicolon holds the odometer reading, the work done and the shop note. The date of the transaction already records when the service happened. 

A repair transaction can carry the parts list and the diagnosis in its comment, next to the amount paid. Anyone reading the journal later sees the cost and the reason together. Search the file for a word such as timing or brake to find the history. 

Keep the note short and factual, and put the same wording on every similar job. Consistent words make searching reliable across years of entries. The journal stays a record of facts, not a diary. 

## Handle insurance, fees and irregular charges 

Insurance premiums and registration fees arrive on their own schedule and often cover a future period. Record the payment on the date it leaves the account, in the vehicle expense account for that cost type. A comment can state the period the payment covers. 

If you prefer to spread a prepaid premium across months, record the payment as an asset and post a monthly expense from it. This approach needs more discipline and more entries. Many owners simply record the payment when it happens and accept a lumpy monthly view. 

Irregular charges such as inspections or roadside service get their own expense children only if you want to track them apart. Otherwise a general fees account holds them. The report total stays the same either way, and only the detail changes. 

## Read balance reports for one vehicle 

A balance report on the vehicle parent account shows the total cost and the breakdown by child account. Run it for a month, a quarter or a year by adding a date range to the command. The same report works for a single vehicle or for a fleet parent. 

Compare periods by running the report on two date ranges and reading the totals side by side. A rise in the repairs child points to the part of the record worth reading. The report shows recorded amounts, and it cannot show a cost you never entered. 

The journal itself is the source, so a wrong total means a wrong or missing posting. Check the transaction list for the period when a figure looks off. Correct the posting and rerun the report, and the totals follow. 

## Separate business and private use 

A vehicle used for both business and private trips needs the two uses kept apart in the accounts. One approach records every cost in the vehicle expense branch and marks the business share in a comment. Another approach splits each transaction between a business and a private child account. 

The split method gives a direct report of the business share without further arithmetic. It also requires a share figure on every transaction, which takes time. Choose one method and apply it to every entry, because mixed methods make the reports unreliable. 

Tax rules for vehicle deductions differ by country and change over time. A qualified accountant decides how to treat the business share for your situation. The journal supplies the record, and the accountant sets the treatment. 

## Keep the journal accurate over time 

A plain-text journal is easy to back up and easy to break, so keep a copy outside the working file. Version control gives a history of every change and lets you undo a bad edit. A dated backup achieves much of the same protection. 

Enter transactions soon after the receipt arrives, while the details are still clear. A weekly review of the journal catches a missing fuel entry or a mistyped amount. Small regular checks keep the annual report trustworthy. 

Use one description style for each kind of cost, such as the station name for fuel and the shop name for repairs. Consistent descriptions make search and review fast. The record then answers questions about the vehicle years after the fact. 

## Questions about hledger vehicle costs 

### How do I track hledger vehicle costs for more than one car? 

Give each car its own expense branch under a shared parent, such as expenses:car1 and expenses:car2. A report on the parent totals the fleet, and a report on one branch isolates a single car. Keep the branch names stable so old transactions stay in the right place. 

### Can hledger record fuel volume as well as money? 

Yes, hledger stores commodity amounts, so a fuel posting can hold both the money paid and the liters or gallons added. The journal keeps both figures, and a report can show either one. This lets you compare consumption across fills without a separate log. 

### Where do service notes go in an hledger journal? 

Service notes go in a comment on the transaction, starting with a semicolon on its own line. The comment can hold the odometer reading, the work done and the shop note. The transaction date records when the service happened. 

### Which report shows what a vehicle costs in total? 

A balance report on the vehicle expense parent account shows the total and the breakdown by cost type. Add a date range to see a month, a quarter or a year. The figure reflects only the transactions you entered. 

### Should I split business and private vehicle costs in hledger? 

Splitting the costs into business and private child accounts makes the business share easy to report. The simpler alternative records all costs in one branch and marks the share in a comment. A qualified accountant decides the treatment that applies to your situation. 

### Is an hledger journal safe for long-term vehicle records? 

A plain-text journal is durable because any text editor can read it and copies are simple to make. Keep a backup or version history outside the working file. The record lasts as long as the file is kept and readable.
