Swelıty
Tools for everyone

Free Online Svelte Playground

Write a Svelte 5 component and see it run, with everything you log shown in a console beside the preview. Script, markup and style live together in one file.

Press Run, or Ctrl or Cmd + Enter, to run your code. The page shows in Preview and everything you log shows in Console. Use Stop if a script never ends. Write one Svelte 5 component, with its script, markup and style together.

App.svelte

Preview

Console

Output appears here. Press Run, then try console.log("Hello")

How to use

  1. Write a Svelte component in the editor: a script for state, markup, and a style block.

  2. Press Run, or Ctrl or Cmd + Enter. The component is compiled and shown in the preview, and the console shows what you log.

  3. Use Stop if your code never ends. Turn on Auto-run if you want it to run as you type.

  4. If the component has a mistake, the compiler's message and the lines around it show in the console.

  5. Copy the code, download a zip of your files or clear the editor with the icons above it.

  6. Open the full screen editor for more room, and use the A buttons to resize the text.

  7. Untick Wrap long lines to scroll sideways instead of wrapping.

Why use this tool

  • Svelte 5

    The current Svelte with runes, snippets, bindings, blocks, transitions and scoped styles.

  • One file, like real Svelte

    Script, markup and style in a single component, the way you would write an .svelte file.

  • Compiler messages

    Mistakes and accessibility warnings from the Svelte compiler appear in the console with their line.

  • Isolated preview

    Your component runs in an isolated frame, so it cannot reach this site or your other tabs.

  • Comfortable editor

    Resize the text, switch line wrapping on or off, or go full screen with the editor and preview side by side.

About this tool

Write a Svelte 5 component and see it render live in your browser. Put the script, markup and style in one component, press Run, and the preview updates with everything you log shown in a console beside it. Use it to learn Svelte, try runes such as $state and $derived, bindings, blocks like {#if} and {#each}, and scoped styles, or to test an idea without creating a project. The compiler runs in the preview, so there is nothing to install.

Frequently asked questions

Svelte 5, with its compiler and runtime loaded from a public CDN. Runes such as $state, $derived and $effect are available.

Not yet. The playground compiles one component, called App. Put everything in that file, and use snippets and blocks to keep it organised.

Svelte 5 can compile lang="ts" in a script tag, but type checking is not done here. The TypeScript Playground is the place to try types.

Check that you pressed Run and that the console has no compiler error. A component needs markup to show, and the style block only changes how it looks.

Not yet. The Format button works for the other playgrounds, but not for Svelte components.

Yes. Untick Wrap long lines under the editor and it scrolls sideways instead. Your choice is remembered on this device.

Yes, the first time. The Svelte compiler and runtime are loaded from a public CDN when you press Run.