Question: I would like to use TikZ in other settings than TeX and I'd especially like to use the drawings on websites where the text should be searchable and selectable. However, I'm unsure of the best way to convert my drawings to SVG.

How do I best take some TikZ code, render the drawing and turn the output into SVG?

Answer: 
You can use [dvisvgm](https://dvisvgm.de/), which is a built-in tool of some TeX distributions (e.g. MiKTeX).

The basic usage:

```
latex testsvg.tex
dvisvgm testsvg.dvi

```

Then the SVG file will be saved in the current directory.

If you converted a simple math formula but get garbage when displaying the SVG, you can run `dvisvgm` with option `--no-fonts` to replace the fonts with path elements.

```
dvisvgm --no-fonts testsvg.dvi

```

As of version 2.0, you can call `dvisvgm` with option `--font-format=woff`, you should get SVG files that render correctly in almost all recent web browsers.

```
dvisvgm --font-format=woff testsvg.dvi

```

If you use TeXstudio, you can edit the `texstudio.ini` file (located in `AppData\Roaming\TeXstudio` for Windows) and add the following line below `[texmaker]`.

```
Tools\Commands\dvi2svg="txs:///latex | dvisvgm --font-format=woff %.dvi"

```

Restart TeXstudio and you can find your custom command at **Tools->User->dvi2svg**.
If I run dvisvgm with option `-n` and the evaluation of PostScript specials is enabled, I get the expected result:

![enter image description here](https://i.stack.imgur.com/sap2r.png)

Since MiKTeX doesn't provide a dvisvgm binary through its repositories, you have to install it manually. Recent builds for MiKTeX are available from the [dvisvgm website](http://dvisvgm.sourceforge.net/Downloads). Simply extract `dvisvgm.exe` to the MiKTeX subfolder `miktex\bin`, or even better, install it in a [local texmf tree](https://tex.stackexchange.com/questions/69483/create-a-local-texmf-tree-in-miktex).