ToolWeb Logo
Menu

Flutter to HTML Converter

Paste Flutter widget code, a build() method or a whole main.dart file and get the same screen as HTML and CSS, with Flutter layout rules and Material 3 colors and sizes. Preview it on a phone screen, then copy or download it.

Bottom-Line Summary: Paste a widget, a build() method or a whole Dart file. The converter runs your Dart code (classes, state, helper methods, loops, themes) and lays it out with Flutter's own rules: constraints, Expanded, Stack, Material 3 sizes and colors. You get one HTML file with CSS, previewed on a phone screen. It runs in your browser in WebAssembly; your code is never uploaded.

Automatic: an app or a Scaffold fills the screen, like runApp; a single widget gets the room a screen gives it.

Preview

Paste Flutter code or load an example to see it here.

Going the other way? Use the HTML to Flutter converter.

How to use Flutter to HTML

  1. 1

    Paste your Flutter code. Paste a single widget such as Center(child: Text('Hi')), a build() method, or a whole main.dart file with several classes. You can also upload or drop a .dart file, or load one of the examples.

  2. 2

    Pick a screen size. Choose a phone, a large phone or a tablet. The converter gives your widgets the same constraints Flutter would on that screen, so Expanded, Center and scroll views size the same way.

  3. 3

    Check the preview and notes. The preview shows the converted page on the chosen screen. Notes list anything that could not be copied exactly, such as values that only exist at runtime or asset images.

  4. 4

    Copy or download the HTML. Copy the full page, just the HTML or just the CSS, or download a ready-to-open .html file. Choose classes in a style block or inline styles.

By · Last updated

Learn more about Flutter to HTML

What Does a Flutter to HTML Converter Do?

Direct Answer: A Flutter to HTML converter takes the Dart code that describes a Flutter screen and produces HTML and CSS that draws the same screen in a web browser. Flutter does not use HTML: it paints widgets itself. So the converter has to work out where each widget ends up and how big it is, then express that with web layout (flexbox, grid and positioning).

ToolWeb's converter does this in three steps. It parses your Dart code, runs it to get the widget tree your build() methods return, and lays out that tree using the rules from Flutter's Understanding constraints guide before writing the HTML.

How Flutter Widgets Map to HTML and CSS
FlutterHTML and CSS
Column, Rowflex containers with the same main and cross axis alignment
Expanded(flex: 2)flex: 2 1 0px
Container, Padding, SizedBoxa div with width, height, padding, margin and decoration (color, gradient, border, radius, shadow)
Stack, Positioneda one-cell grid with absolutely positioned children
ListView, GridView, CustomScrollViewscrolling flex or grid containers; builders are run for their item count
Text, Text.rich<p> and <span> with the TextStyle and Material type scale
Icon(Icons.home)Material Icons font ligature, including outlined and rounded styles
Scaffold, AppBar, FloatingActionButtonpage layout with a 64px Material 3 app bar and a 56px FAB 16px from the corner
TextField, ElevatedButton, Switch<input> and <button> styled like Material 3
How Accurate Is the Conversion?

Direct Answer: For layout, sizes and colors, very close. Every release is checked with 146 test cases run in Chrome on a 390 × 844 screen, from a single Text to full apps. They include all 29 examples from Flutter's "Understanding constraints" article, the layout tutorial (Oeschinen Lake, Pavlova, cards, grids) and cookbook recipes (lists, tabs, themes, slivers). Each case checks element positions and sizes to within a pixel against what Flutter lays out.

Some things cannot be copied exactly: fonts may render a little differently in a browser, animations and gestures become static HTML, and values that only exist while the app runs (data from an API, a provider or user input) are shown as placeholders. Those cases are listed in the notes under the preview.

What Code Can I Paste?
  • A single widget: Center(child: Text('Hello')), with or without a leading child:.
  • A build() method body with local variables and a return.
  • A whole Dart file: the converter starts from runApp() in main(), or picks the top widget class if there is no main.

Imports of other packages are ignored. Widgets from packages the converter does not know are drawn as labelled placeholder boxes so the rest of the layout stays correct. Google Fonts used through GoogleFonts.* are linked automatically.

Why Use It?
  • Web or email versions of a Flutter screen without Flutter Web's large download.
  • Landing pages and docs that match your app's look.
  • Reviews and handoff: share a screen as a single HTML file anyone can open.
  • Learning: see how Flutter's layout model compares to CSS flexbox.

Going the other way? The HTML to Flutter converter turns HTML and CSS into widget code.

Is My Code Safe?

Direct Answer: Yes. The converter is a Rust program compiled to WebAssembly that runs in a Web Worker in your browser. Your code is not uploaded. The preview runs in a sandboxed frame with no access to this site. The converter also protects your browser: very large inputs, endless loops and runaway recursion are stopped with a message, and a conversion that takes longer than 8 seconds is cancelled.

Frequently Asked Questions

How do I convert Flutter code to HTML?
Paste your Flutter widget code, a build() method or a whole main.dart file into the converter. It runs your Dart code, lays out the widgets with Flutter's constraint rules and shows the HTML and CSS result on a phone preview. Copy the code or download a single .html file.
Is the HTML output the same as my Flutter app?
Layout, sizes and colors follow Flutter closely: the converter is tested with 146 cases, including every example in Flutter's Understanding constraints article, checked to within a pixel in Chrome. Fonts can render slightly differently in browsers, animations become static, and values that only exist at runtime are shown as placeholders and listed in the notes.
Does it support StatefulWidget, themes and custom widgets?
Yes. Custom StatelessWidget and StatefulWidget classes, initState, fields, getters, helper methods, loops and collection if/for are run like Dart would run them. ThemeData, ColorScheme.fromSeed, TextTheme and Material 2 or Material 3 are applied.
Is my code uploaded to a server?
No. The converter is written in Rust and compiled to WebAssembly, and it runs in a Web Worker in your browser. Your code never leaves your device.
What happens if I paste a very large file or code with an endless loop?
The converter has limits on input size (1.5 MB), nesting depth, run time and list length. Code that loops forever or recurses without end is stopped with a message, and any conversion that takes longer than 8 seconds is cancelled, so the page never freezes.
Can I convert widgets from packages?
Flutter's own Material, Cupertino and widgets libraries are supported. Widgets from other packages are drawn as labelled placeholder boxes (wrappers show just their child) so the rest of the layout stays correct, and Google Fonts used through GoogleFonts are linked automatically.