Generate valid Australian Tax File Numbers (TFN) for testing purposes
Disclaimer: These are randomly generated valid TFN numbers for testing purposes only. Do not use for any official or fraudulent purposes. These numbers are not associated with real individuals.
Maximum 100 numbers per generation
TFN (Tax File Number) generator creates valid test TFN numbers for Australian tax system testing. TFN uses a weighted checksum algorithm. For software testing only - fraudulent use is a criminal offense.
Generate 8 random digits, calculate check digit using weighted sum (weights: 1,4,3,7,5,8,6,9,10), ensure sum divisible by 11. Check digit makes total sum divisible by 11 with no remainder.
TFN format: 9 digits (8 base + 1 check). Check algorithm: multiply each digit by weight [1,4,3,7,5,8,6,9,10], sum products, valid if sum % 11 === 0. Not all 9-digit numbers with valid checksums are issued TFNs.
Test payroll and tax systems.
Verify TFN input validation.
Test super fund integrations.
Generate test employee records.
// TFN check digit weights
const TFN_WEIGHTS = [1, 4, 3, 7, 5, 8, 6, 9, 10];
// Validate TFN
function validateTFN(tfn) {
const digits = String(tfn).replace(/\s/g, '').split('').map(Number);
if (digits.length !== 9 || digits.some(isNaN)) {
return false;
}
const sum = digits.reduce((acc, digit, i) => {
return acc + (digit * TFN_WEIGHTS[i]);
}, 0);
return sum % 11 === 0;
}
// Generate valid TFN
function generateTFN() {
// Generate 8 random digits
const digits = Array(8).fill(0).map(() => Math.floor(Math.random() * 10));
// Calculate what check digit is needed
const partialSum = digits.reduce((acc, digit, i) => {
return acc + (digit * TFN_WEIGHTS[i]);
}, 0);
// Find check digit that makes sum divisible by 11
// Check digit weight is 10 (last weight)
for (let checkDigit = 0; checkDigit <= 9; checkDigit++) {
const totalSum = partialSum + (checkDigit * TFN_WEIGHTS[8]);
if (totalSum % 11 === 0) {
digits.push(checkDigit);
return digits.join('');
}
}
// If no valid check digit found, regenerate
return generateTFN();
}
// Format TFN with spaces
function formatTFN(tfn) {
const clean = String(tfn).replace(/\D/g, '');
return clean.replace(/(\d{3})(\d{3})(\d{3})/, '$1 $2 $3');
}
// Generate multiple TFNs
function generateMultipleTFNs(count) {
return Array(count).fill(0).map(() => formatTFN(generateTFN()));
}
// Examples
console.log(validateTFN('123 456 782')); // Check if valid
console.log(generateTFN()); // e.g., "648517309"
console.log(formatTFN(generateTFN())); // e.g., "648 517 309"
// Bulk generation for testing
console.log(generateMultipleTFNs(5));Complete TFN implementation with modulus 11 validation, generation, and formatting.
Use for testing Australian tax software, payroll systems, or super fund integrations. Never use generated numbers for actual tax purposes.
Yes, if used to deceive. Generating for testing is fine. Using a fake TFN for tax purposes, employment, or benefits is fraud with severe penalties.