# FunC language overview (https://docs-fpm2731fy-ton-core-docs.vercel.app/llms/languages/func/overview/content.md)



<Callout type="note">
  The official smart contract language of TON Blockchain is [Tolk](/llms/tolk/overview/content.md). FunC is now a **legacy** language, with its compiler no longer maintained.

  Learn how to [migrate from FunC to Tolk](/llms/tolk/from-func/tolk-vs-func/content.md). For new smart contract projects, use the [Acton toolchain](/llms/contract-dev/acton/content.md).
</Callout>

FunC is a domain-specific, statically typed language with C-like syntax designed to write smart contracts on TON. It can be characterized as an intermediate-level language sitting on top of the [Fift](/llms/languages/fift/content.md) assembly language.

Example of a FunC function for sending funds:

```func
() send_money(slice address, int amount) impure inline {
    var msg = begin_cell()
        ;; Set the message to be non-bounceable
        .store_uint(0x10, 6)
        .store_slice(address)
        .store_coins(amount)
        .end_cell();

    send_raw_message(msg, 64);
}
```

where

* [`()`](/llms/languages/func/types/content.md) is the return type, that stands for "do not return value", similar to `void` in C;
* `send_money` is the name of the function;
* `slice address` is the first parameter, address to send money to; it's type is [`slice`](/llms/languages/func/types/content.md);
* `int amount` is the second parameter, amount to be sent; it's type is [`int`](/llms/languages/func/types/content.md);
* `impure inline` are [specifiers](/llms/languages/func/functions/content.md), which are flags that tell the compiler to process the method in a specific way;
* `var msg = ...` defines a variable without specifying its type; it will hold a [cell](/llms/foundations/serialization/cells/content.md) with a [message](/llms/foundations/messages/overview/content.md);
* [`begin_cell()`](/llms/languages/func/stdlib/content.md) creates a [cell builder](/llms/tvm/builders-and-slices/content.md);
* [`store_uint`](/llms/languages/func/stdlib/content.md), [`store_slice`](/llms/languages/func/stdlib/content.md), [`store_coins`](/llms/languages/func/stdlib/content.md) methods store data into the builder:
  * [flags](/llms/foundations/messages/internal/content.md);
  * receiving address;
  * amount on Toncoin to attach to the message.
* [`.end_cell()`](/llms/languages/func/stdlib/content.md) method finalizes the builder and turns it into a cell;
* [`send_raw_message`](/llms/languages/func/stdlib/content.md) function sends the message, where the parameter `64` describes a [sending mode](/llms/foundations/messages/internal/content.md).

## Compiler [#compiler]

The compiler converts FunC programs into [Fift](/llms/languages/fift/content.md) assembly code. The Fift assembly code is then compiled down to the [TON Virtual Machine](/llms/tvm/overview/content.md) bitcode by the [Fift](/llms/languages/fift/content.md) compiler.

Developers can use the compiled bitcode, structured as a [bag of cells](/llms/foundations/serialization/boc/content.md) like all data in the TON blockchain, to test smart contracts, send messages, or execute it in a local TVM instance.

### End-to-end tooling [#end-to-end-tooling]

The easiest way to install the FunC compiler is the [`@ton-community/func-js`](https://www.npmjs.com/package/@ton-community/func-js) NPM package. It requires [Node.js](https://nodejs.org/en/download) v22 or later.

The package has both the FunC and [Fift](/llms/languages/fift/content.md) compilers, and produces bitcode directly from the FunC source code, without manually invoking Fift.

To install it, run the following command in the project root folder:

```bash
npm i @ton-community/func-js
```

Then, to compile a specific FunC file, run the following command:

```bash
npx func-js ./contract.fc --boc ./output.boc
```

where `contract.fc` is the FunC source file in the project root, and `output.boc` is the compiled bitcode output.

FunC standard library is supplied separately from the language. Download `smartcont_lib.zip` from the [latest release](https://github.com/ton-blockchain/ton/releases), extract it, and copy `stdlib.fc` to the project root.

Alternatively, use the [Blueprint](/llms/contract-dev/blueprint/overview/content.md) to start a project pre-configured for development in FunC.

### Compile manually using the binaries [#compile-manually-using-the-binaries]

Prebuilt FunC compiler binaries for Windows, macOS (Intel or ARM64), and Ubuntu are available on the [GitHub](https://github.com/ton-blockchain/ton/releases).

1. Download the corresponding binary for operating system:

   * Linux: `func-linux-x86_64` (Intel/AMD) and `func-linux-arm64` (ARM64)
   * Mac: `func-mac-x86-64` (Intel/AMD) and `func-mac-arm64` (ARM64)
   * Windows: `func.exe`

   Rename the executable, for example, to `func`, for easier use on the command line, and add it to system's `PATH`.

2. Download the FunC standard library.

   Get the `smartcont_lib.zip` from the same [GitHub](https://github.com/ton-blockchain/ton/releases/tag/v2025.07), extract it, and copy `stdlib.fc` to project root.

3. Compile a FunC file to Fift assembly code.

   Run the following command in the project root:

```bash
func contract.fc -o output.fif
```

where `contract.fc` is the FunC file to compile, and `output.fif` is the generated Fift output.

To compile the generated Fift file `output.fif` further down to TVM bitcode, use the Fift compiler. See the [Fift](/llms/languages/fift/content.md) for download and usage instructions.

<Callout>
  The last FunC compiler version is v2025.07. The FunC compiler is no longer developed. New releases are focused on the [Tolk](https://github.com/ton-blockchain/ton/releases/latest) compiler.
</Callout>

## Tutorials [#tutorials]

<Callout>
  The tutorials in this section are provided by external contributors and may not reflect FunC's current development status. They are offered as additional resources for exploring FunC's applications.
</Callout>

* [Challenge 1: Simple NFT deploy](https://github.com/romanovichim/TONQuest1/)
* [Challenge 2: Chatbot contract](https://github.com/romanovichim/TONQuest2/)
* [Challenge 3: Jetton vending machine](https://github.com/romanovichim/TONQuest3/)
* [Challenge 4: Lottery/raffle](https://github.com/romanovichim/TONQuest4/)
* [Challenge 5: Create UI to interact with the contract in 5 minutes](https://github.com/romanovichim/TONQuest5/)
* [Challenge 6: Analyzing NFT sales on the Getgems marketplace](https://github.com/romanovichim/TONQuest6/)
* [TON hello world Part 2: guide for writing your first smart contract](https://ton-community.github.io/tutorials/02-contract/)
* [TON hello world Part 4: guide for testing your first smart contract](https://ton-community.github.io/tutorials/04-testing/)
* [10 lessons for developing contracts in FunC](https://github.com/romanovichim/TonFunClessons_Eng/) — [Russian version](https://github.com/romanovichim/TonFunClessons_ru/)
* [FunC quiz](https://t.me/toncontests/60/) — a short Telegram quiz focused on FunC, with a few general TON questions.

## Contests [#contests]

| Contest           | Tasks                                                     | Solutions                                                                                                                                                           |
| :---------------- | :-------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| TSC #5 (Dec 2023) | [Tasks](https://github.com/ton-community/tsc5/)           | —                                                                                                                                                                   |
| TSC #4 (Sep 2023) | [Tasks](https://github.com/ton-community/tsc4/)           | [1](https://github.com/aSpite/tsc4-contracts) [2](https://github.com/ProgramCrafter/tsc4) [3](https://github.com/Gusarich/tsc4) [4](https://github.com/akifoq/tsc4) |
| TSC #3 (Dec 2022) | [Tasks](https://github.com/ton-blockchain/func-contest3/) | [Solutions](https://github.com/nns2009/TON-FunC-contest-3/)                                                                                                         |
| TSC #2 (Jul 2022) | [Tasks](https://github.com/ton-blockchain/func-contest2/) | [Solutions](https://github.com/ton-blockchain/func-contest2-solutions/)                                                                                             |
| TSC #1 (Mar 2022) | [Tasks](https://github.com/ton-blockchain/func-contest1/) | [Solutions](https://github.com/ton-blockchain/func-contest1-solutions/)                                                                                             |

## Changelog [#changelog]

[History of FunC](/llms/languages/func/changelog/content.md)
