Skip to main content

Txt To M3u Online Converter Apr 2026

# Live TV channels (m3u8) https://cph-p2p-msl.akamaized.net/hls/live/2003453/test/master.m3u8 https://example.com/stream/720p.m3u8

// Core conversion: TXT string -> M3U string function convertTextToM3U(inputText) if (!inputText.trim()) return "#EXTM3U\n# (No content provided)"; const lines = inputText.split(/\r?\n/); const m3uLines = []; // M3U header m3uLines.push("#EXTM3U"); let addedAny = false; for (let originalLine of lines) trimmed.startsWith("/") // if after processing we have only header and no entries but we had comments, still fine if (!addedAny && m3uLines.length === 1) m3uLines.push("# No valid media entries found."); return m3uLines.join('\n'); // update preview AND store converted content in a data attribute for download/copy let currentM3U = ""; function refreshConversion() const rawText = txtInput.value; const converted = convertTextToM3U(rawText); currentM3U = converted; m3uPreview.textContent = converted; updateLineStats(); return converted; // initial conversion on page load if example needed, but we set an example placeholder function setDefaultExample() const defaultTxt = `# My personal playlist - generated from TXT # Radio streams http://ice1.somafm.com/groovesalad-128-mp3 https://streamer.radio.co/somejazz/listen

.info-note background: #ecfdf5; border-radius: 1rem; padding: 1rem; margin-top: 1.8rem; font-size: 0.85rem; border-left: 4px solid #2c7da0; color: #115e59;

button.primary:hover background: #0f3b57; transform: translateY(-1px); Txt To M3u Online Converter

textarea width: 100%; height: 280px; padding: 1rem; font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace; font-size: 0.85rem; line-height: 1.45; background: #fefefe; border: 1px solid #cbd5e1; border-radius: 1rem; resize: vertical; transition: 0.2s; outline: none; color: #0a1c2a;

// update line stats (non-empty + non-comment visual) function updateLineStats() const raw = txtInput.value; const lines = raw.split(/\r?\n/); let validMediaLines = 0; for (let line of lines) line = line.trim(); if (line === "") continue; if (line.startsWith("#")) continue; // comments are not media entries but kept as-is validMediaLines++; lineStatsSpan.textContent = `$validMediaLines media line$validMediaLines !== 1 ? 's' : ''`;

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes"> <title>TXT to M3U Converter | Online Playlist Tool</title> <meta name="description" content="Convert plain text lists of URLs or media paths to M3U playlist format instantly. No server, no uploads — 100% private client-side tool."> <style> * box-sizing: border-box; # Live TV channels (m3u8) https://cph-p2p-msl

.section-title font-weight: 600; font-size: 1.1rem; margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.5rem; color: #1e2f3e; border-left: 4px solid #2c7da0; padding-left: 0.75rem;

.preview-box background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 1rem; padding: 0.75rem; height: 280px; overflow-y: auto;

.m3u-pre font-family: monospace; font-size: 0.8rem; white-space: pre-wrap; word-break: break-all; margin: 0; color: #0f2b3b; const lines = inputText.split(/\r?\n/)

button background: #f1f5f9; border: 1px solid #cbd5e1; padding: 0.6rem 1.2rem; border-radius: 2rem; font-weight: 500; font-size: 0.85rem; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 0.5rem; color: #1e2f3e;

body background: linear-gradient(145deg, #f6f9fc 0%, #eef2f5 100%); font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, sans-serif; margin: 0; min-height: 100vh; display: flex; justify-content: center; align-items: center; padding: 1.5rem;