✏️ Crossword Puzzle Maker

Create your own custom crossword puzzles!

Advertisement Space

728 x 90 Banner

Create Crossword Puzzle

📝 How to Create

1. Enter a title for your puzzle
2. Add words and their clues
3. Click "Generate Crossword"
4. The system will automatically arrange the words!

Advertisement Space

728 x 90 Banner

${title}

${tableRows.join('')}
Across
${clueList(across)}
Down
${clueList(down)}
`; } function downloadWord() { const output = document.getElementById('puzzleOutput'); if (!output || output.style.display === 'none') { alert('Generate a crossword first.'); return; } // Ensure blank grid (no answers) for exporting. hideAnswers(); const title = document.getElementById('displayTitle')?.textContent || 'Crossword Puzzle'; const html = buildWordExportHtml(); const blob = new Blob(['\ufeff', html], { type: 'application/msword' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = `${safeFileName(title)}.doc`; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); } function trimGrid(grid) { let minRow = grid.length, maxRow = 0, minCol = grid[0].length, maxCol = 0; for (let r = 0; r < grid.length; r++) { for (let c = 0; c < grid[0].length; c++) { if (grid[r][c]) { minRow = Math.min(minRow, r); maxRow = Math.max(maxRow, r); minCol = Math.min(minCol, c); maxCol = Math.max(maxCol, c); } } } const trimmed = []; for (let r = minRow; r <= maxRow; r++) { const row = []; for (let c = minCol; c <= maxCol; c++) { row.push(grid[r][c] || null); } trimmed.push(row); } // Update solution keys const newSolution = {}; for (let key in solution) { const [r, c] = key.split('-').map(Number); newSolution[`${r - minRow}-${c - minCol}`] = solution[key]; } solution = newSolution; return trimmed; } function displayCrossword() { const gridElement = document.getElementById('crosswordGrid'); gridElement.innerHTML = ''; gridElement.style.gridTemplateColumns = `repeat(${currentGrid[0].length}, 40px)`; for (let r = 0; r < currentGrid.length; r++) { for (let c = 0; c < currentGrid[0].length; c++) { const cell = document.createElement('div'); cell.className = 'crossword-cell'; if (currentGrid[r][c]) { const key = `${r}-${c}`; if (solution[key]?.number) { const num = document.createElement('span'); num.className = 'number'; num.textContent = solution[key].number; cell.appendChild(num); } const input = document.createElement('input'); input.type = 'text'; input.maxLength = 1; input.dataset.answer = currentGrid[r][c]; cell.appendChild(input); } else { cell.classList.add('black'); } gridElement.appendChild(cell); } } displayClues(); } function displayClues() { const across = wordPlacements.filter(w => w.direction === 'across') .sort((a, b) => a.number - b.number); const down = wordPlacements.filter(w => w.direction === 'down') .sort((a, b) => a.number - b.number); document.getElementById('acrossClues').innerHTML = across .map(w => `
${w.number}. ${w.clue}
`) .join(''); document.getElementById('downClues').innerHTML = down .map(w => `
${w.number}. ${w.clue}
`) .join(''); } function showAnswers() { document.querySelectorAll('.crossword-cell input').forEach(input => { if (input.dataset.answer) { input.value = input.dataset.answer; } }); } function hideAnswers() { document.querySelectorAll('.crossword-cell input').forEach(input => { input.value = ''; }); } function sharePuzzle() { const url = window.location.href; if (navigator.share) { navigator.share({ title: document.getElementById('displayTitle').textContent, text: 'Check out this crossword puzzle!', url: url }).catch(() => copyLink(url)); } else { copyLink(url); } } function copyLink(url) { navigator.clipboard.writeText(url).then(() => { alert('Link copied to clipboard!'); }); } // Initialize with one word-clue entry window.addEventListener('load', () => { // Keep at least 3 rows visible (HTML already has 1 row) addWordClue(); addWordClue(); });