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.
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.
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
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
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
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
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 Mohit Khatri · Last updated
Learn more about Flutter to HTML
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.
| Flutter | HTML and CSS |
|---|---|
| Column, Row | flex containers with the same main and cross axis alignment |
| Expanded(flex: 2) | flex: 2 1 0px |
| Container, Padding, SizedBox | a div with width, height, padding, margin and decoration (color, gradient, border, radius, shadow) |
| Stack, Positioned | a one-cell grid with absolutely positioned children |
| ListView, GridView, CustomScrollView | scrolling 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, FloatingActionButton | page 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 |
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.
- A single widget:
Center(child: Text('Hello')), with or without a leadingchild:. - A build() method body with local variables and a
return. - A whole Dart file: the converter starts from
runApp()inmain(), or picks the top widget class if there is nomain.
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.
- 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.
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.