Open source toolkit for Polish KSeF FA(3) e-invoicing.
- 100% free forever β no limits, no signup, no hidden costs
- Privacy-first β everything runs locally in your browser
- Official compliance β full XSD validation against Ministry of Finance schemas
- Multilingual β Polish, English, Ukrainian
π ksefuj.to β free online validator π¦ @ksefuj/validator β npm package + CLI
KSeF (Krajowy System e-Faktur) is Poland's mandatory e-invoicing system. Starting April 1, 2026 (February 1, 2026 for large companies), all VAT taxpayers must issue structured XML invoices through KSeF using the FA(3) schema.
- XSD Schema Validation β full compliance with official Ministry of Finance schemas
- MF Semantic Rules β catches errors that XSD can't express, per the official FA(3) information sheet
- Extra checks β tax calculation math, NBP currency rates, IBAN format: things KSeF won't catch
- 100% client-side β your invoice data never leaves your browser
- Offline capable β bundled schemas, no network requests needed
- Fast validation β WebAssembly-powered, optimized for multiple validations
- npm package β
@ksefuj/validatorwith TypeScript support - CLI tool β
npx @ksefuj/validator invoice.xml - Claude Skills β ready-made skills for generating e-invoices in Claude Projects
- Minimal dependencies β only libxml2-wasm for XSD validation, TypeScript, ESM modules
Visit ksefuj.to, drop your XML file, done.
npx @ksefuj/validator invoice.xmlpnpm add @ksefuj/validator
# or npm install @ksefuj/validator
# or yarn add @ksefuj/validatorimport { validate } from "@ksefuj/validator";
// Full validation with XSD + semantic rules (default)
const result = await validate(xmlString);
// With options
const result = await validate(xmlString, {
locale: "en", // 'pl' (default) | 'en' | 'uk'
enableXsdValidation: true, // default: true
enableSemanticValidation: true, // default: true
});
if (!result.valid) {
// Check XSD errors
const xsdErrors = result.errors.filter((e) => e.source === "xsd");
// Check semantic errors
const semanticErrors = result.errors.filter((e) => e.source === "semantic");
for (const error of result.errors) {
console.error(`${error.source}: ${error.message}`, error.path);
}
}ksefuj/
βββ packages/
β βββ validator/ β @ksefuj/validator (npm + CLI)
β βββ src/schemas/ β Bundled XSD schemas from Ministry of Finance
βββ apps/
β βββ web/ β ksefuj.to (Next.js app)
βββ scripts/
β βββ update-schemas.ts β Schema maintenance tool
βββ skills/
βββ ksef-fa3/ β Claude skill for invoice generation
Full validation against official Ministry of Finance FA(3) XSD schemas:
- libxml2-wasm β WebAssembly-powered validation in the browser
- Bundled schemas β no network requests, CORS-free, offline capable
- Official compliance β uses exact schemas from crd.gov.pl
- Detailed error reporting β line numbers, element paths, specific violations
44 comprehensive validation rules based on the official FA(3) information sheet from the Ministry of Finance:
- Podmiot Rules (8 rules) β Entity validation, JST/GV requirements, NIP placement
- Fa Core Rules (5 rules) β P_15 requirement, mutual exclusions, currency handling
- Adnotacje Rules (11 rules) β All mandatory fields, selection logic for exemptions/margin procedures
- FaWiersz Rules (4 rules) β Tax rate validation, GTU format, decimal precision
- Corrective Invoice Rules (2 rules) β KSeF number consistency, reverse charge validation
- Payment & Transaction Rules (8 rules) β Payment dates, bank accounts, currency pairs, NBP rate validation
- Format Rules (2 rules) β Number formatting, separator validation
- Additional Business Logic Rules (4 rules) β Tax calculations, bank account format, line number uniqueness, negative quantities
- Missing mandatory Adnotacje fields (P_16, P_17, P_18, P_18A, Zwolnienie, etc.)
- Incorrect JST/GV setup requiring specific Podmiot3 roles
- Polish NIP in wrong field (should be in NIP field, not NrVatUE)
- Wrong tax rates for foreign buyers ('np I'/'np II' vs 'oo')
- GTU format errors (
<GTU>GTU_12</GTU>not<GTU_12>1</GTU_12>) - Decimal precision violations (amounts >2, prices >8, quantities >6 decimals)
- Selection logic violations in Zwolnienie, NoweSrodkiTransportu, PMarzy
- Currency inconsistencies (foreign currency needs PLN conversions)
- Number formatting issues (thousand separators, wrong decimal separator)
- Tax calculation errors (incorrect VAT amounts, wrong totals)
- Invalid Polish bank account format (IBAN must be 28 chars: PL + 26 digits; NRB must be 26 digits)
- Duplicate invoice line numbers
- Negative quantities in non-corrective invoices
The skills/ directory contains skills for Claude Projects:
- ksef-fa3 β generates FA(3) XML invoices from input data (PDF, text, form)
Installation: download the .skill file from Releases
and add to your Claude Project.
Requires Node.js 18+ and pnpm:
git clone https://github.com/ksefuj/ksefuj.git
cd ksefuj
pnpm install
pnpm dev # runs web app on localhost:3000
pnpm build # builds all packages
pnpm test # runs tests in all packages
pnpm update-schemas # updates XSD schemas from government sourcesThe validator uses bundled XSD schemas to avoid CORS issues. To update them:
pnpm update-schemasThis downloads the latest schemas from crd.gov.pl, compares with existing files, and updates the
bundle if changes are detected. Run this:
- Monthly to check for updates
- Before releases
- After Ministry of Finance announces schema changes
- Full XSD schema validation (libxml2-wasm)
- Semantic business rules engine
- Bundled schemas (CORS-free, offline capable)
- Visual validation badges (XSD + semantic)
- CLI tool
- Web app with drag & drop
- npm package
- Schema update tool
- i18n setup (PL + EN + UK)
- Deploy to production
- Validator UI improvements (multi-file upload, better error output)
- Human-readable error messages with fix instructions
- Landing page with trust signals and feature sections
- MDX content pipeline (docs, guides, blog)
- FAQ page (full MDX content, PL/EN/UK, JSON-LD FAQPage schema)
- Blog (first article live: KSeF od 1 kwietnia 2026)
- Sitemap, OG images, hreflang, Twitter cards across all content
- Behavioral analytics
- RSS feed
- Global validation counter (Vercel KV)
- Publish @ksefuj/validator to npm registry
- XML β HTML invoice visualization
- Autofix suggestions (one-click error fixes)
- PDF export (client-side via browser print / jsPDF)
- QR code generation (required for invoices sent outside KSeF)
- Form-based XML generation
- Auto NBP exchange rates
- Auto NIP lookup (GUS/VIES)
Apache 2.0
A permissive open source license that allows commercial use, modification, and distribution. Requires preservation of copyright and license notices.