back

2025-07-18

Ethers vs Viem — the challenger gaining ground

Dev tooling

In the Ethereum development ecosystem, libraries for blockchain interactions have evolved rapidly. Ethers.js has long been the standard—and remains so—providing a comprehensive JavaScript toolkit for wallets, contracts, providers, and more since its inception around 2016. However, Viem—launched in March 2023 by the team behind Wagmi—has gained significant traction as a modern, TypeScript-centric alternative. Often described as "Ethers.js but better" for contemporary needs, Viem emphasizes modularity, type safety, and performance.

This article examines why Viem is gaining momentum despite Ethers' continued dominance, what each library does well, and community insights from X discussions and developer comparisons.

Historical context: From Ethers dominance to Viem's rise

Ethers.js rose to prominence as a lighter, more user-friendly successor to Web3.js, offering intuitive APIs for Ethereum interactions. By 2023, it powered countless dApps with features like robust provider handling and contract abstractions. Its v6 release in mid-2023 addressed some modern needs, like better async support.

Viem entered the scene in March 2023 as "a TypeScript Interface for Ethereum," focusing on stability, bundle size, and developer experience. Built by the Wagmi creators, it integrates seamlessly with React hooks and prioritizes modularity—allowing devs to import only needed components. By 2025, benchmarks showed Viem outperforming Ethers in bundle size (31KB gzipped vs. Ethers' larger footprint) and type inference.

Adoption surged in frontend stacks, with projects praising its lightweight nature over Ethers and Web3.js. While Ethers remains widely used, Viem's growth mirrors the industry's shift toward TypeScript-heavy, performant tools amid rising L2 complexity.

Viem's key advantages: What makes it better

Viem excels in areas where modern dApp development demands efficiency and safety:

Bundle Size

  • Viem: ~31KB gzipped, tree-shakable, import only what you need
  • Ethers: ~130KB+, monolithic, harder to optimize
  • Why it matters: Reduces load times, ideal for mobile or bandwidth-sensitive dApps

Type Safety

  • Viem: Strict TypeScript-first with compile-time checks for contracts, errors, and ABIs
  • Ethers: Good TS support in v6, but less rigorous and more prone to inference issues
  • Why it matters: Fewer runtime errors in production

Performance

  • Viem: Deterministic, composable APIs with built-in error handling
  • Ethers: Efficient but can feel abstracted
  • Why it matters: Better for scalable apps, embraces "boring code" for flexibility

Ecosystem

  • Viem: Native to Wagmi, deep EIP support, tools for multicall and simulation
  • Ethers: Broad compatibility, used in Hardhat, but heavier for hooks-based frontends
  • Why it matters: Powers modern React stacks

Developer Experience

  • Viem: Educational docs, migration guides, focuses on clarity over abstraction
  • Ethers: User-friendly APIs, but steeper learning curve for strict TS environments
  • Why it matters: Steeper initial curve but addresses the quadrilemma of DX, stability, size, and performance

What Ethers missed

Ethers.js is still reliable and feature-rich, but it didn't adapt quickly enough to emerging trends like extreme modularity and TypeScript dominance:

  • Size and overhead. Ethers' larger bundle became a liability in frontend-heavy dApps, where Viem's 27-31KB size shines. Ethers missed optimizing for tree-shaking early on.

  • Type rigidity. While v6 improved, Ethers lagged in compile-time safety compared to Viem's strict typing, leading to more runtime issues in TypeScript projects.

  • Modularity lag. Ethers' all-in-one approach contrasts with Viem's import-what-you-need philosophy, making it less flexible for lightweight integrations.

  • Innovation pace. Features like deterministic APIs and deep EIP focus were slower in Ethers. Viem's verbose but composable style allows easier changes, while Ethers' abstraction sometimes hides complexities.

  • Ecosystem shift. As Wagmi and similar tools rose, Ethers didn't integrate as tightly, missing the frontend wave. Some devs note Ethers' maturity for diverse contracts, but Viem's lightness wins for modern platforms.

Hybrid uses exist—Ethers for backend, Viem for frontend—but Ethers' overhead tilted the balance toward Viem for new projects.

Developer activity tells the story

Let's look at the actual data. Scraping open source projects using data from Electric Capital and OpenQ, Ethers.js remains the most used JavaScript library in crypto by a significant margin.

Chart showing ethers.js at 101k projects vs viem at 36k projects in open source usage

Ethers.js is used in 101k projects compared to Viem's 36k projects—nearly a 3:1 ratio. This isn't surprising given Ethers' eight-year head start and deep integration into tutorials, bootcamps, and existing codebases.

But the raw numbers don't tell the full story. Viem launched in March 2023, meaning it accumulated 36k project adoptions in under two years. That growth rate is remarkable. The Wagmi ecosystem—which powers a significant portion of web3 frontend development—is built entirely on Viem, and major protocols are increasingly adding Viem examples alongside Ethers in their documentation.

What's particularly telling is where new projects land. While Ethers dominates the install base, Viem is capturing a disproportionate share of greenfield development. Open source health isn't just about current adoption—it's about trajectory. Viem's development velocity and community responsiveness signal a library that's actively evolving with developer needs rather than maintaining legacy patterns.

Community opinions: The debate on X and beyond

Discussions on X and developer blogs reveal a clear split: Viem praised for modernity, Ethers for reliability.

Pro-Viem voices: The @wevm_dev team introduced Viem as an alternative to Ethers.js and Web3.js, emphasizing performance and DX. Developers view Viem as a "schelling point" for Ethereum UX, superior to predecessors. Blogs highlight Viem's edge in bundle size and types for dApps, with one post calling it "the ultra-lightweight driver" for high-performance needs.

Pro-Ethers holdouts: Some prefer Ethers for ease and maturity. One dev notes it's "more mature" for transposing tests to frontend code. In comparisons, Ethers wins for accessibility and rich resources built up over years.

Balanced takes: Tools like Voltaire support both styles, showing coexistence is viable. Overall sentiment leans toward Viem for innovative, growing communities vs. Ethers' established base. Debates often note Viem's steeper learning curve but better long-term fit for TypeScript-heavy teams.

The consensus: Viem for modern TS apps, Ethers for broad reliability.

When to choose each (or use both)

Pick Viem if:

  • You're building frontend-focused, type-safe projects
  • You're using or planning to use Wagmi for React hooks
  • Bundle size and performance are priorities
  • You want the latest EIP support and modern patterns

Stick with Ethers if:

  • You have an established codebase with heavy Ethers usage
  • You need quick deployments with familiar patterns
  • Your environment is less TypeScript-strict
  • You rely on Ethers-specific plugins without Viem equivalents

Hybrid approach: Use Ethers for complex backend operations where its maturity shines, and Viem for lightweight frontends where bundle size matters. Many teams are adopting this split successfully.

Conclusion: A shifting landscape

Ethers.js hasn't lost—it still commands nearly 3x the project adoption of Viem. But the trajectory matters. Viem's rapid growth in under two years, combined with its technical advantages in bundle size, type safety, and ecosystem integration, signals a genuine shift in developer preferences for new projects.

The Ethereum JavaScript library space is healthier for having real competition. For developers building today, the choice depends on context: Viem for greenfield TypeScript projects prioritizing performance, Ethers for stability and ecosystem breadth. The data suggests that gap will continue to narrow.