# citation-js

> Citation.js converts formats like BibTeX, Wikidata JSON and ContentMine JSON to CSL-JSON to convert to other formats like APA, Vancouver and back to BibTeX.

Latest version **0.8.2** (published 2026-07-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install citation-js
pnpm add citation-js
yarn add citation-js
bun add citation-js
```

Provides the command `citation-js`.

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.8.2 |
| Published | 2026-07-13 |
| First published | 2016-10-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=14 |
| Dependencies | 12 |
| Unpacked size | 6 MB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 241 |
| Author | Lars Willighagen |
| Maintainers | larsgw |
| Keywords | citation, bibtex, wikidata, contentmine, quickscrape, csl, citeproc |

## Links

- npm: https://www.npmjs.com/package/citation-js
- Repository: https://github.com/larsgw/citation.js
- Homepage: https://citation.js.org/
- Issues: https://github.com/larsgw/citation.js/issues
- npm.io page: https://npm.io/package/citation-js

## Dependencies (12)

- [citeproc](https://npm.io/package/citeproc.md) ^2.4.59
- [patch-package](https://npm.io/package/patch-package.md) ^8.0.1
- [@citation-js/cli](https://npm.io/package/@citation-js/cli.md) 0.8.2
- [@citation-js/core](https://npm.io/package/@citation-js/core.md) 0.8.2
- [@citation-js/date](https://npm.io/package/@citation-js/date.md) 0.5.1
- [@citation-js/name](https://npm.io/package/@citation-js/name.md) 0.4.2
- [@citation-js/plugin-csl](https://npm.io/package/@citation-js/plugin-csl.md) 0.8.2
- [@citation-js/plugin-doi](https://npm.io/package/@citation-js/plugin-doi.md) 0.8.2
- [@citation-js/plugin-ris](https://npm.io/package/@citation-js/plugin-ris.md) 0.8.2
- [@citation-js/plugin-bibtex](https://npm.io/package/@citation-js/plugin-bibtex.md) 0.8.2
- [@citation-js/plugin-bibjson](https://npm.io/package/@citation-js/plugin-bibjson.md) 0.8.2
- [@citation-js/plugin-wikidata](https://npm.io/package/@citation-js/plugin-wikidata.md) 0.8.2

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.8.2 (latest) — 2026-07-13
- 0.8.1 — 2026-07-06
- 0.8.0 — 2026-07-06
- 0.7.22 — 2025-12-31
- 0.7.21 — 2025-10-20
- 0.7.20 — 2025-07-05
- 0.7.19 — 2025-05-12
- 0.7.18 — 2025-01-28
- 0.7.17 — 2025-01-28
- 0.7.16 — 2024-09-23
- 0.7.15 — 2024-08-11
- 0.7.14 — 2024-06-12
- 0.7.13 — 2024-06-06
- 0.7.12 — 2024-05-07
- 0.7.11 — 2024-04-17
- … 96 more at https://npm.io/package/citation-js/versions

## README

[![NPM version](https://img.shields.io/npm/v/citation-js.svg)](https://npmjs.org/package/citation-js)
[![NPM total downloads](https://img.shields.io/npm/dt/citation-js.svg)](https://npmcharts.com/compare/citation-js?minimal=true)
[![Build Status](https://travis-ci.org/larsgw/citation.js.svg?branch=master)](https://travis-ci.org/larsgw/citation.js)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

Please use [citation-js/citation-js](https://github.com/citation-js/citation-js) if possible.

| [citation-js/citation-js](https://github.com/citation-js/citation-js) | replaces | [larsgw/citation.js](https://github.com/larsgw/citation.js) |
|---|---|---|
| This repository contains the npm package `@citation-js/core` and several other components. || This repository contains the npm package `citation-js` that wraps the aforementioned components for backwards compatibility. |

---

<!-- toc -->

- [Install](#install)
- [Getting Started](#getting-started)
- [CLI](#cli)
- [`Cite`](#cite)
  * [Async](#async)
- [Acknowledgements](#acknowledgements)

<!-- tocstop -->

# Install

On Node.js, install the package ([citation-js](https://npmjs.org/package/citation-js)) like this:

    npm install citation-js

To install the CLI as a global command, do this:

    npm install --global citation-js

Browser releases are available [here](https://github.com/larsgw/citation.js/tree/archive). These define `require` and add `citation-js` as a module.

```html
<script src="path/to/citation.js" type="text/javascript"></script>
<script>
  const Cite = require('citation-js')
</script>
```

# Getting Started

You can read a guide on how to get started, together with some tutorials and examples, [here](https://citation.js.org/api/tutorial-getting_started.html).

# CLI

> [More info](https://citation.js.org/api/tutorial-cli.html)

Run the CLI like this:

    citation-js  [options]

    Options:

      -h, --help                      output usage information
      -V, --version                   output the version number

      -i, --input <path>              Input file
      -u, --url <url>                 Input url
      -t, --text <string>             Input text

      -o, --output <path>             Output file (omit file extension)

      -R, --output-non-real           Do not output the file in its mime type, but as a string
      -f, --output-type <option>      Output structure type: string, html, json
      -s, --output-style <option>     Output scheme. A combination of --output-format json and --output-style citation-* is considered invalid. Options: csl (Citation Style Lanugage JSON), bibtex, citation-* (where * is any formatting style)
      -l, --output-language <option>  Output language. [RFC 5646](https://tools.ietf.org/html/rfc5646) codes

# `Cite`

> [More info](https://citation.js.org/api/tutorial-cite_.html)

To use the [`Cite`](#cite) constructor, `require()` the module like this:

```js
const Cite = require('citation-js')
```

For example, to get the bibliographical data of the Wikidata item [`wd:Q21972834`](https://wikidata.org/wiki/Q21972834), and then format it in HTML, English and APA:

```js
let example = new Cite('Q21972834')

let output = example.format('bibliography', {
  format: 'html',
  template: 'apa',
  lang: 'en-US'
})

console.log(output)
```

To test this code, go to [RunKit](https://runkit.com/larsgw/591b5651bd9b40001113931c).

## Async

Use the async API (recommended for Wikidata, URL, and DOI input) like this:

```js
let example = await Cite.async('Q21972834')

let output = example.format('bibliography', {
  format: 'html',
  template: 'apa',
  lang: 'en-US'
})

console.log(output)
```

> `Cite.async()` also supports options as the second argument, and a callback function as last argument.

---
_Source: https://npm.io/package/citation-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
