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: 
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).
In LuaLaTeX, there's an alternative to the accepted answer that is faster (in compilation time).

```
%! TEX program = lualatex

% instead of doing this...
%\documentclass[tikz, convert={outext=.svg,pdf2svg}]{standalone}

% you do the following...
\documentclass[tikz]{standalone}
\directlua{luatexbase.add_to_callback("wrapup_run", function() os.execute("pdf2svg \jobname.pdf \jobname.svg") print("Converted to SVG.") end, "final callback to convert pdf file")}

\begin{document}
\begin{tikzpicture}
\draw (0,0) -- (1,1);
\end{tikzpicture}
\end{document}

```

The output is the same.

I explained what the `standalone` package does by default at <https://tex.stackexchange.com/a/671818/250119>.
You can see it's more efficient because it needs to spawn another `lualatex` process, while this method only requires spawning `pdf2svg`.

On my machine, this method is faster by roughly 0.8 seconds.