We’re delighted to announce the release of webR 0.6.0. WebR brings R to the web browser using WebAssembly, powering Quarto Live , Shinylive , and other interactive R experiences.

As a reminder of what webR can do, here is an interactive code editor running R in the browser. Try it out!

It’s been almost a year since I’ve written a blog post about webR, and so this post highlights some key features and improvements over the last few releases. For a full list of changes, see the recent release notes on GitHub .

Updates to R, Emscripten, and LLVM#

We’ve updated the version of R on which webR is based to version 4.6.0, ensuring we have all the latest improvements and bug fixes from the R core team. For example, the new %notin% operator can now be used:

Under the hood, we’ve also upgraded Emscripten to version 5.0.7. Emscripten serves as the crucial layer between the web browser and R’s source code, playing a role similar to an operating system. We’ve also updated the version of LLVM we use to compile Fortran sources to 21.1.8.

Improvements to Fortran on WebAssembly#

The R source code contains a surprising amount of Fortran code (the bulk of which written in F77-style), even today. For webR, we rely on a forked version of LLVM Flang with custom patches to add support for emitting WebAssembly. I won’t go into the deep technical details here, but I have written about it before if you are interested.

For a long time, dynamic array operations introduced in more modern Fortran standards were not supported by our fork. This meant that some packages which use these Fortran features would not work in webR, crashing with a dense and largely unhelpful runtime error message:

program p
  integer :: a(5) = [1, 2, 3, 4, 5]
  print *, sum(a)
end program
$ ./previous/flang -c arr.f90 -o arr.o
$ emcc arr.o libFortranRuntime.a -o arr.js
$ node arr.js
  fatal Fortran runtime error(...reduction-templates.h(90)): Internal error:
  RUNTIME_CHECK(TypeCode(CAT, KIND) == x.type() || ...) failed

However, thanks to a hint originating from a community member , we’ve now added a workaround for the underlying compiler problem, and R packages which rely on these Fortran features should now work in webR without crashing:

$ ./latest/flang -c arr.f90 -o arr.o
$ emcc arr.o libFortranRuntime.a -o arr.js
$ node arr.js
  15

Additional system libraries#

We’ve also added or updated the following system libraries compiled to WebAssembly, which are now available for use by R packages in webR:

  • cacert.pem 2026-05-14
  • fontconfig v2.15.0
  • libpoppler v24.12.0
  • libsodium v1.0.22
  • libtiff v4.7.1
  • libuv v1.44.2
  • openssl v3.5.1

Async/await in webr::eval_js()#

One of the biggest issues when working with webR’s JavaScript API is that we must block the worker thread running the WebAssembly R process. This is required to make sure we can wait and take input from the user, both at the top-level and in functions like readline() or browser(). Previously, this meant that only synchronous JavaScript code could be run from R via webr::eval_js(), and JavaScript features like Promise, async or await were not available.

By proxying the JavaScript code to the main thread, we’ve added support for running asynchronous JavaScript code in webr::eval_js(). You can now use await = TRUE to wait for a Promise to resolve before returning a value to R:

webr::eval_js("new Promise((res) => res(1729))")
[1] 1729

Or equivalently, you can use await inside an async JavaScript function:

webr::eval_js(r"{
  (async () => {
    await new Promise(r => setTimeout(r, 500));
    return 87539319;
  })();
}", await = TRUE)
[1] 87539319

Using curl under WebAssembly#

Using similar techniques, we have also added support for proxying WebSocket traffic via the main thread. This, combined with some other work for libcurl in WebAssembly , means we can now use the curl and httr2 R packages in webR.

Try out a full example R script using httr2 in the webR app .

Dark mode for the webR app#

Speaking of the webR app, if your system is set to dark mode the webR app will now automatically switch to a dark theme. This feature was contributed by an attendee of Tidyverse Developer Day 2025 . Thanks, Kyle!

The webR app in light and dark.

Acknowledgements#

And, as always, a huge thank you to everyone else who has contributed to webR, either by submitting bug reports, contributing code, or just sharing feedback.

@AABoyles , @ai-petri , @brendanhcullen , @bryce-carson , @chizapoth , @coatless , @daniel-woodie , @dipterix , @dusadrian , @georgestagg , @goebbe , @HenrikBengtsson , @jeroen , @jgf5013 , @jmbo1190 , @JosiahParry , @khusmann , @kyleGrealis , @laderast , @lpmi-13 , @pepijn-devries , @seanbirchall , @szcf-weiya , @timelyportfolio , @tulaydixon , @WardBrian , and @WillemSleegers .