AR.js is a JavaScript library for building augmented reality experiences that run directly in the web browser. It provides the core capability to render digital content overlaid on the real world using either the A-Frame HTML component system or the three.js JavaScript library, supporting both marker-based and location-based AR approaches.
The library enables tracking of predefined 2D images, fiducial markers, and image targets through the device camera, allowing virtual objects such as 3D models, videos, or images to be positioned relative to recognized visual references. For location-based AR, it can anchor content to real-world GPS coordinates, placing virtual objects at specific latitude and longitude positions that update their size and orientation as the user moves and rotates their device.
Additional capabilities include generating tracking data files from source images, responding to user interactions with augmented content, and overlaying DOM elements on the camera view for clickable interfaces. The library can be installed via npm or imported using ES modules for use with modern JavaScript frameworks.