Boleto generator and validator
A boleto is Brazil’s printed or digital payment slip, identified by a barcode and a typeable line (linha digitável). Generate fictitious ones with every check digit correct to test barcode readers, parsers, OCR and checkout screens in sandbox environments. Generated boletos are not registered with any bank and must never be paid.
Up to 1000 items at once. Everything is generated in your browser.
How to use
- On the generator tab, choose the Type: bank slip (bancário, 47 digits, issued by a bank) or utility/tax bill (arrecadação, 48 digits). For bank slips you can also choose the Bank or leave it on Any.
- Tick With mask (punctuation) to get the line with dots and spaces as printed, or untick it for digits only. Click Generate, then Copy.
- For a test dataset, set the Quantity (1–1000) and use Export CSV, Export JSON or Export SQL. Each row has the typeable line, barcode, type, bank, due date and amount.
- On the Validate tab, paste one typeable line (47 or 48 digits) or barcode (44 digits) per line. Dots, hyphens and spaces are ignored.
- Each result shows whether it is valid with the decoded bank, amount and due date, or the reason: wrong length, invalid characters, wrong field digit (naming the field) or wrong general check digit.
How it works
Bank slips: barcode and typeable line
Boletos are regulated by Banco Central do Brasil (Circular 3,598/2012) and their layouts are standardised by FEBRABAN, the Brazilian banking federation. The barcode has 44 positions: bank code (1–3), currency 9 = real (4), general check digit (5), due-date factor (6–9), amount in cents (10–19) and the bank’s free field (20–44). The typeable line rearranges the same data into 47 digits and 5 fields:
- Field 1: bank + currency + free-field positions 1–5 + DV (10 digits).
- Field 2: free-field positions 6–15 + DV (11).
- Field 3: free-field positions 16–25 + DV (11).
- Field 4: the barcode’s general check digit (1).
- Field 5: due-date factor + amount (14).
Fields 1–3 use mod 10: weights 2, 1, 2, 1… from right to left; products above 9 have their digits added; DV = (10 − sum mod 10) mod 10. The general digit uses mod 11 over the other 43 barcode positions with weights 2 to 9 from the right, cycling; DV = 11 − remainder, and results 0, 10 and 11 become 1.
The due-date factor and the 2025 reset
The factor counts days since 1997-10-07. It reached 9999 on 2025-02-21 and, as announced by FEBRABAN, restarted at 1000 on 2025-02-22. Each factor therefore maps to two dates 9,000 days apart; the validator picks the one closest to today. Factor 0000 means no due date.
Worked example: 34192.90055 62293.552790 14298.128241 5 16500000046404
Field 1 341929005, from the right: 5×2=10→1, 0, 0, 9, 2×2=4, 9, 1×2=2, 4, 3×2=6; sum 35; DV = 10 − 5 = 5.
Field 2 6229355279: 6 + 4 + 2 + (18→9) + 3 + (10→1) + 5 + 4 + 7 + (18→9) = 50; DV 0. Field 3 1429812824: 1 + 8 + 2 + 9 + 8 + 2 + 2 + 7 + 2 + 8 = 49; DV 1.
Barcode: 34195165000000464042900562293552791429812824. Without position 5, the weighted sum (weights 2–9) is 864; 864 mod 11 = 6; 11 − 6 = 5, which is field 4. Factor 1650 = 2025-02-22 + 650 days = 2026-12-04; amount 0000046404 = R$ 464.04; bank 341 (Itaú).
Utility and tax bills (arrecadação, start with 8)
Utility bills and taxes use 48 digits: 4 blocks of 11 with one check digit each. Digit 2 is the segment and digit 3 the value identifier: 6 or 7 → mod 10; 8 or 9 → mod 11 (6 and 8 mean the amount is in reais). The general digit sits at barcode position 4. Example generated here: 83690000042-0 52678617628-3 09604695044-8 68755616675-3 (R$ 4,252.67).
FAQ
Can I pay a boleto generated here?
No, and do not try. The free field is random and no charge is registered behind it. If a line happened to match a real bill, the payment would go to a third party. Use these boletos only for parser, barcode-reading, OCR, UI and sandbox integration tests.
Does a valid line mean the boleto exists?
No. The validator checks length, field digits and the general digit, and decodes bank, amount and due date. Whether a bill exists, was paid or is overdue can only be checked with the issuing bank or the billing platform, which this tool does not contact.
Why can the same factor mean two dates?
Because the factor has only four digits. After reaching 9999 on 2025-02-21 it restarted at 1000 the next day. Your system has to pick the right cycle; the common approach, used here, is to take the date closest to the current day.
What is the difference between the typeable line and the barcode?
They carry the same data in a different order. The barcode has 44 digits and is read by scanners; the typeable line has 47 (bank slip) or 48 (utility/tax bill) digits, with extra per-field check digits to catch typing errors. The validator accepts both formats.
Does the free field follow the chosen bank’s layout?
No. Each bank structures the 25 free-field positions (portfolio, “nosso número”, branch, account) in its own way. The generator fills that part with random digits, while bank code, factor and amount follow the standard. To test a specific bank’s layout, use that bank’s sandbox.
Sources
- Banco Central do Brasil — Circular 3,598 establishing the boleto (Portuguese)
- FEBRABAN — Brazilian Federation of Banks (boleto and collection layouts)
- brazilian-utils — open-source library with boleto validation
- boleto-utils — open-source validator supporting the 2025 factor
Related tools
Updated 2026-11-13 · Rafael Lima